2014-10-29 13 views
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()); 
    } 

} 

답변

1

저는 꽤 새로워서 제대로 작동하지 않았습니다. 그러나 플래시가 가지고있는 것과 똑같은 것처럼 보입니다. seek이 버퍼를 플러쉬 한 후에 바이트를 다시 추가하면됩니다. 다음은 제가보고있는 기사입니다. 잘하면 도움이됩니다.

https://forums.adobe.com/thread/646900?tstart=0

+0

예, 분명 도움이 될 것입니다. 감사! – JuCachalot