0
플래시 10을 대상으로 한 Haxe 프로젝트에서 임베드 된 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