0
在一個Haxe項目與閃光燈10作爲唯一的目標,我想尋找一個嵌入式FLV。我試圖用NetStream
類和appendBytes
方法來做到這一點,但我發現這種方法不能工作,因爲seek
方法在調用時刷新緩衝區。有沒有什麼辦法可以達到這個目的:在尋求嵌入式flv?尋找與Haxe嵌入式FLV
package;
import flash.utils.ByteArray;
import flash.display.Sprite;
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.events.NetStatusEvent;
import flash.events.Event;
// Embedding the video in the SWF here
@:file("Assets/v1.flv") class Vid1 extends ByteArray {}
class TestProject extends Sprite {
public var vid:Video;
public var nc:NetConnection;
public var ns:NetStream;
public function new()
{
super();
addEventListener(Event.ADDED_TO_STAGE, mainSWFLoaded);
}
public function playVideo():Void
{
vid = new Video();
nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, onConnect);
nc.connect(null);
}
public function onConnect(evt:NetStatusEvent):Void
{
if (evt.info.code == 'NetConnection.Connect.Success') {
ns = new NetStream(nc);
ns.client = {};
ns.play(null);
ns.appendBytes(new Vid1());
vid.attachNetStream(ns);
// With this line commented, the video plays until the end
// but if I uncomment it, it will flush the buffer
// and the video won't play...
// ns.seek(3);
flash.Lib.current.addChild(vid);
}
}
public function mainSWFLoaded(evt:Event):Void
{
playVideo();
}
public static function main()
{
flash.Lib.current.addChild(new TestProject());
}
}
是的,我一定會有所幫助。謝謝! – JuCachalot 2014-11-10 11:55:40