码迷,mamicode.com
首页 > 其他好文 > 详细

浏览器播放器

时间:2020-04-30 15:09:10      阅读:96      评论:0      收藏:0      [点我收藏+]

标签:str   static   smp   object   m3u8   always   ESS   where   dem   

页面实现 m3u8的浏览器播放器:

法案一:

<!DOCTYPE hmtl>
<html>
<head>
<title>the5fire m3u8 test</title>
</head>
<body>
<video controls autoplay >
    <source src="http://stream.gravlab.net/003119/sparse/v1d30/posts/2014/barcelona/barcelona.m3u8">
</video>
</body>
</html>

法案二:

通过开源的swfobject.js以及两个flash组件:OSMF和HLSProvider

<!DOCTYPE html>
<html>
<head>
<title>the5fire m3u8 test</title>
<script src="http://sss.the5fire.com/staticfile/swfobject.js"></script>
</head>
<body>
<div id="player">
</div>
<script>
   var flashvars = {
       // M3U8 url, or any other url which compatible with SMP player (flv, mp4, f4m)
       // escaped it for urls with ampersands
       src: escape("http://www.the5fire.com/static/demos/diaosi.m3u8"),
       // url to OSMF HLS Plugin
       plugin_m3u8: "http://www.the5fire.com/static/demos/swf/HLSProviderOSMF.swf",
   };
   var params = {
       // self-explained parameters
       allowFullScreen: true,
       allowScriptAccess: "always",
       bgcolor: "#000000"
   };
   var attrs = {
       name: "player"
   };

   swfobject.embedSWF(
       // url to SMP player
       "http://www.the5fire.com/static/demos/swf/StrobeMediaPlayback.swf",
       // div id where player will be place
       "player",
       // width, height
       "800", "485",
       // minimum flash player version required
       "10.2",
       // other parameters
       null, flashvars, params, attrs
   );
</script>
</body>
</html>

flask 起一个web 服务

拓展:

开源项目的地址:
    http://osmf.org
    http://osmf.org/dev/2.0gm/StrobeMediaPlayback.html
    https://github.com/mangui/HLSprovider

浏览器播放器

标签:str   static   smp   object   m3u8   always   ESS   where   dem   

原文地址:https://www.cnblogs.com/shaozheng/p/12808714.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!