通过FLVPlayback组件播放的ByteArray FLV

编程入门 行业动态 更新时间:2024-10-24 04:40:28
本文介绍了通过FLVPlayback组件播放的ByteArray FLV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有没有办法通过一个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

本文发布于:2023-07-11 12:21:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1094041.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:组件   FLVPlayback   FLV   ByteArray

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!