有没有办法通过一个FLVPlayback组件?
Is there any way of playing a byteArray through a FLVPlayback component?
我要加载一个加密的视频,解密和播放。 我可以做的装载和解密的一部分,但我不知道如何通过FLVPlayback组件播放。随着追求功能和播放停止键。
I want to load an Encrypted video, decrypt it and play it. I can do the loading and decrypting part but i don't know how to play it through a FLVPlayback component. With seeking functions and play stop buttons.
推荐答案有一种方式来加载和ByteArray的形式播放FLV视频,但我不知道这是否是可能的夫妇这与寻求,播放和暂停通过FLVPlayback组件本身的功能。
There is a way to load and play FLV video in ByteArray form, but I don't know if it's possible to couple this with the seek, play and pause functionality through an FLVPlayback component itself.
在我的例子中,我已经添加了暂停/恢复功能,但追求是困难的,因为解决方法把此ByteArray从服务器的RTMP流,而不是一个逐步加载的视频。
In my example I've added pause/unpause functionality, but seeking is difficult since the workaround treats this ByteArray as an RTMP stream from a server, as opposed to a progressively loaded video.
这是与在舞台上的FLVPlayback组件的FLA的文档类(实例名称的FLVPlayback ),它只是嵌入了一个本地FLV为字节数组,这是在顶部引用:
This is a document class for an FLA with an FLVPlayback component on the stage (with instance name flvPlayback), and it just embeds a local FLV as ByteArray, which is referenced at the top:
package { import flash.display.Sprite; import flash.events.MouseEvent; import flash.events.NetStatusEvent; import flash.NetConnection; import flash.NetStream; import flash.NetStreamAppendBytesAction; import flash.utils.ByteArray; import fl.video.FLVPlayback; public class VideoFromByteArray extends Sprite { [Embed(source="your_video.flv", mimeType="application/octet-stream")] private var TestVideo:Class; public var flvPlayback:FLVPlayback; //Instantiated on stage in FLA// private var _nc:NetConnection; private var _ns:NetStream; private var _ba:ByteArray; public function VideoFromByteArray() { ui_init(); } private function ui_init():void { _nc = new NetConnection(); _nc.connect(null); _ns = new NetStream(_nc); _ns.client = { }; _ns.addEventListener(NetStatusEvent.NET_STATUS, ns_netStatus); flvPlayback.getVideoPlayer(0).attachNetStream(_ns); _ba = new TestVideo(); _ns.play(null); _ns.appendBytes(_ba); _ns.send("|RtmpSampleAccess", true, true); stage.addEventListener(MouseEvent.CLICK, stage_click); } private function stage_click(evt:MouseEvent):void { _ns.togglePause(); } private function ns_netStatus(event:NetStatusEvent):void { var code:String = event.info.code; switch(code) { case "NetStream.Buffer.Empty": _ns.seek(0); break; case "NetStream.Seek.Notify": if (event.info.seekPoint == 0) ns_seekToBeginning(); break; } } private function ns_seekToBeginning():void { _ns.appendBytesAction(NetStreamAppendBytesAction.RESET_BEGIN); _ns.appendBytes(_ba); _ns.appendBytesAction(NetStreamAppendBytesAction.END_SEQUENCE); } } }更多推荐
通过FLVPlayback组件播放的ByteArray FLV
发布评论