- 4.代码使用
- 4.1 [A]swfObject调用
- 4.2 [B]object调用
- 4.3 [C]Ebemb调用
- 4.4 [D]JS形式调用
- 4.5 JS函数交互
- 4.6 广告相关
- [1] 前置广告
- [2] 视频广告
- [3] 暂停广告
- [4] 角标广告
- [5] 后置广告
- [6] 滚动文字广告
- 4.7 开灯关灯
- 4.8 高清模式
- 4.9 分享模式
- 4.10 视频模式
- 4.11 RTMP点播
- 4.12 RTMP直播
- 4.13 视频结束动作
- 4.14 色彩自定义
- 4.15 移动终端适配(New)
- 4.16 HLS直播(m3u8适配)
- 4.17 适配PC/安卓/苹果
- 4.18 收费模式(节目预览)
- 4.19 播放器logo设定
- 4.20 视频文件说明
- 4.21 提示点MoveTip
- 4.22 列表连播功能
4.11 RTMP直播
RTMP(Real Time Messaging Protocol)实时消息传送协议是Adobe Systems公司为Flash播放器和服务器之间音频、视频和数据传输开发的私有协议。
本播放器,既支持http协议,也rtmp协议。并且只须设置rtmp服务器JcScpServer参数,即可,很方便,其它代码不变。
RTMP直播范例:
例(4.12)-1:rtmp协议下的播放器调用代码示例
<script type="text/javascript" src="/player/js/swfobject.js"></script>
<div class="video" id="CuPlayer"> <b> <img src="/player/images/loading.gif" /> 网页视频播放器加载中,请稍后...</b> </div>
<script type="text/javascript">
var so = new SWFObject("/player/player.swf","ply","980","460","9","#000000");
so.addParam("allowfullscreen","true");
so.addParam("allowscriptaccess","always");
so.addParam("wmode","opaque");
so.addParam("quality","high");
so.addParam("salign","lt");
<!-- HTML代码参数/Begin -->
so.addVariable("JcScpServer","rtmp://www.yourServer.com/live"); //您的rtmp流媒体服务器地址
so.addVariable("JcScpVideoPath","livestream"); //流名称
so.addVariable("JcScpImg","/player/images/startpic.jpg"); //视频缩略图
so.addVariable("JcScpFile","/player/CuSunV3Set.xml"); //配置文件
<!-- HTML代码参数/End -->
so.write("CuPlayer");
</script>
例(4.12)-2:rtmp协议下的播放器调用代码示例
第1部分:
<script type="text/javascript" src="/player/js/swfobject.js"></script>
<div class="video" id="CuPlayer"> <b> <img src="/player/images/loading.gif" /> 网页视频播放器加载中,请稍后...</b> </div>
<script type="text/javascript">
var so = new SWFObject("/player/player.swf","ply","980","460","9","#000000");
so.addParam("allowfullscreen","true");
so.addParam("allowscriptaccess","always");
so.addParam("wmode","opaque");
so.addParam("quality","high");
so.addParam("salign","lt");
<!-- HTML代码参数/Begin -->
so.addVariable("JcScpFile","/player/CuSunV3Set.xml"); //配置文件
<!-- HTML代码参数/End -->
so.write("CuPlayer");
</script>
第2部分,以下是配置文件CuSunV3Set.xml代码如下(直播时,把JcScpLiveMode直播模式值设为 1,隐藏进度条):
<CuPlayer>
<Player_Set
JcScpBufferTime = "5"
JcScpVolume = "75"
JcScpCode = "utf8"
JcScpImgDisplay = "no"
JcScpAutoHideControl ="yes"
JcScpControlHideTime="0.5"
JcScpControlHeight="40"
JcScpShowList= "yes"
JcScpAutoRepeat = "no"
JcScpsetMode = "1"
JcScpAFrontCanClose = "no"
JcScpShowRightmenu = "yes"
JcScpShareMode = "JcScpVideoPath"
JcScpLoadbarMode = "0"
JcScpLiveMode = "1"
/>
<Logo_Set
JcScpLogoDisplay = "yes"
JcScpLogoPath = "images/logo.png"
JcScpLogoPosition = "top-left"
JcScpLogoWidth = "165"
JcScpLogoHeight = "75"
JcScpLogoAlpha = "1"
/>
<Flashvars_Set
JcScpServer ="rtmp://www.yourServer.com/live"
JcScpVideoPath = "livestream"
JcScpVideoPathHD = ""
JcScpImg ="images/startpic.jpg"
JcScpAutoPlay = "yes"
JcScpStarTime = "0"
JcScpEndTime = "0"
JcScpCuePointInfo = ""
JcScpCuePointTime = ""
......
......