在Centos6.5+Nginx+RTMP流媒体服务(直播、点播)一文中介绍了搭建点播服务的过程,按照conf中的配置,点播播放时可以支持两种协议,一种rtmp,另外一种是http,刚开始不知道这两种有什么区别,经过一番测试,有以下结果
-
rtmp vod(播放器不下载视频文件)
rtmp://10.2.44.216/vod/flv:large.flv 不可拖动,需要使用其它工具插入关键帧,生成性的flv
-
http vod(播放器会下载视频文件) 都可拖动
http://10.2.44.216:8080/vod/large.flv 播放一开始,直接下载整个文件
http://10.2.44.216:8080/vod/large.mp4 边播放边下载,貌似是播多少下载多少
测试页面代码
player.html
<html>
<head>
<script src="./jwplayer/jwplayer.js"></script>
<script>jwplayer.key="请输入自己的jwplayer.key";</script>
</head>
<body>
<div>rtmp://10.2.44.216/vod/mp4:test_264.mp4</div>
<div id='my-video0'></div>
<script type='text/javascript'>
jwplayer('my-video0').setup({
file:'rtmp://10.2.44.216/vod/mp4:test_264.mp4'
});
</script>
<!-- <div>http://10.2.44.216:8080/hls/test.m3u8</div>
<div id='my-video'></div>
<script type='text/javascript'>
jwplayer('my-video').setup({
file:'http://10.2.44.216:8080/hls/flv:live.m3u8'
});
</script> -->
<div>rtmp://10.2.44.216/vod/mp4:large.mp4</div>
<div id='my-video'></div>
<script type='text/javascript'>
jwplayer('my-video').setup({
file:'rtmp://10.2.44.216/vod/mp4:large.mp4'
});
</script>
<div>rtmp://10.2.44.216/vod/flv:large.flv</div>
<div id='my-video-flv'></div>
<script type='text/javascript'>
jwplayer('my-video-flv').setup({
file:'rtmp://10.2.44.216/vod/flv:large.flv'
});
</script>
<div>rtmp://10.2.44.216/myapp/live</div>
<div id='my-video1'></div>
<script type='text/javascript'>
jwplayer('my-video1').setup({
file:'rtmp://10.2.44.216/myapp/live'
});
</script>
<div>http://10.2.44.216:8080/vod/large.flv</div>
<div id='my-video2'></div>
<script type='text/javascript'>
jwplayer('my-video2').setup({
file:'http://10.2.44.216:8080/vod/large.flv'
});
</script>
<div>http://10.2.44.216:8080/vod/large.mp4</div>
<div id='my-video3'></div>
<script type='text/javascript'>
jwplayer('my-video3').setup({
file:'http://10.2.44.216:8080/vod/large.mp4'
});
</script>
</body>
</html>
测试步骤
- 准备两个视频文件,放入/var/flvs/中,一个large.mp4,一个large.flv(通过ffmpeg转码生成)
- 将player.html放在Apache或者Nginx html目录中,这里注意加载jwplayer.js路径,保证其加载成功
- 在Chrome中打开player.html,打开控制台,查看网络加载状态
测试过程
点击播放,立马开始下载整个large.flv
页面load进来,就有一个large.mp4加载进来,但是只有几M,播放开始之后,缓缓的变大