From 82bd61dd9bc54c8d502b52955801fa1ffa3682a7 Mon Sep 17 00:00:00 2001 From: ouzhou Date: Fri, 19 Jul 2019 15:18:33 +0800 Subject: [PATCH] update --- README.md | 31 ++++++++++++++++++++++++++++++- index.as | 15 ++++++++------- index.fla | Bin 6173 -> 6179 bytes index.html | 20 ++++++++++++++------ index.swf | Bin 10943 -> 10962 bytes 5 files changed, 52 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index b0e35eb..d81dfea 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ rtmp 流直播定制 flash 播放器 // 因为加载 swf 是异步操作,需要等待swf加载完成后才能进行调用 // 但是因为 swf 文件的 onload 并不会调用 // 解决办法有两种 -// 1 在 swf 里面调用一个 js 方法通知(考虑到在react组件中使用,暂无实现) +// 1 在 swf 里面调用一个 js 方法通知(考虑到在react组件中使用,暂无实现) // 2 用定时器判断加载状态 const app = document.getElementById("app"); let timer = null; @@ -95,3 +95,32 @@ app.stopLive(); // 暂停直播,因为是直播流,暂停后不提供续播的功能 app.pause(); ``` + +```js +// rtmp 流状态 用于封装开发做 loading 或者显示播放状态 + +"NetConnection.Connect.Success"; //服务器连接成功 +"NetConnection.Connect.Closed"; //连接中断 +"NetConnection.Connect.Failed"; //连接失败" +"NetConnection.Connect.Rejected"; //没有权限" +"NetStream.Play.Reset"; //播放列表重置" +"NetStream.Play.Start"; //播放开始" +"NetStream.Buffer.Empty"; //视频正在缓冲" +"NetStream.Buffer.Full"; //缓冲区已填满" +"NetStream.Play.StreamNotFound"; //找不到此视频"); +"NetStream.Play.Stop"; //视频播放完成"); +"NetStream.Pause.Notify"; //流已暂停" +"NetStream.Unpause.Notify"; //流已恢复" +"NetStream.Seek.Failed"; //搜寻失败" +"NetStream.SeekStart.Notify"; //搜寻开始" +"NetStream.Seek.Notify"; //正在搜寻……" +"NetStream.Seek.Complete"; //搜寻完毕" +"NetStream.Publish.Start"; //发布开始" +"NetStream.Unpublish.Success"; //停止发布" +"NetStream.Record.Start"; //开始录制" +"NetStream.Record.Stop"; //停止录制" +"NetStream.Publish.BadName"; //警告!试图发布已经被他人发布的流" +"NetStream.Play.PublishNotify"; //发布开始,信息已经发送到所有订阅者"); //测试发布端有没在发布 +"NetStream.Play.UnpublishNotify"; //发布停止,信息已经发送到所有订阅者"); //测试发布端是否停止了发布 +"NetStream.Play.InsufficientBW"; //警告!客户端没有足够的带宽,无法以正常速度播放数据" +``` diff --git a/index.as b/index.as index 532d240..223d091 100644 --- a/index.as +++ b/index.as @@ -5,27 +5,27 @@ var nc = null; var ns = null; var serverName; var streamName; +var videoObj = new Video(800, 450); + +videoObj.smoothing = true; -function log(value) { +function info(value) { try { - ExternalInterface.call("console.log", value); + ExternalInterface.call("Ouzzplayer.status", value); } catch (err) { // empty } } -var videoObj = new Video(800, 450); -videoObj.smoothing = true; - function createLiveStream() { nc = new NetConnection(); nc.client = this; nc.addEventListener(NetStatusEvent.NET_STATUS, function(event) { - log("nc: " + event.info.code); + info(event.info.code); if (event.info.code == "NetConnection.Connect.Success") { ns = new NetStream(nc); ns.addEventListener(NetStatusEvent.NET_STATUS, function(event) { - log("ns: " + event.info.code); + info(event.info.code); }); var nsClientObj = new Object(); ns.client = nsClientObj; @@ -84,6 +84,7 @@ try { ExternalInterface.addCallback("stopLive", destoryLiveStream); ExternalInterface.addCallback("snapshot", snapshot); ExternalInterface.addCallback("pause", pause); + ExternalInterface.call("console.log", 'player is ok'); } catch (err) { // empty } diff --git a/index.fla b/index.fla index 703b7eb54f35efe605a2643a0c3fdaf2af3915a9..205b61c6df700c7e891546373b00d8605103491e 100644 GIT binary patch delta 1926 zcmV;12YL9NFrzS#ihuIh!_*S$dKRdoe*uz%H$ zSsHZ@S-|4D^4X#MQBXgoCCw23fR@rONeZfAv|0vG$F$1_b)_nv2ZZ(qyskJdy!2um zk}okQb;Yz4jxhjrx%jk;`{C}@-cWEyQeB3;y(OqFsmWY#nTby6C1k!^Vj3h_%8PtP`M zO2#}(!wv!Oq>P9`dx(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