玩video.js ustream m3u8文件流 [英] Playing with video.js ustream m3u8 file streaming

查看:259
本文介绍了玩video.js ustream m3u8文件流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾试图在网页上播放带有video.js的m3u8文件流,但我无法做到,我不知道错误在哪里

I have tried to play in a web page a m3u8 file streaming with video.js, But I could not do it, I do not know where the mistake is

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Video</title>

  <link href="http://vjs.zencdn.net/4.12/video-js.css" rel="stylesheet">
  <script src="http://vjs.zencdn.net/4.12/video.js"></script>
 <script src="https://github.com/videojs/videojs-contrib-media-sources/releases/download/v0.1.0/videojs-media-sources.js"></script>
  <script src="https://github.com/videojs/videojs-contrib-hls/releases/download/v0.11.2/videojs.hls.min.js"></script>

</head>
<body>
  <h1>Video</h1>

  <video id="my_video_1" class="video-js vjs-default-skin" controls preload="auto" width="640" height="268" 
  data-setup='{}'>
    <source src="http://iphone-streaming.ustream.tv/uhls/3064708/streams/live/iphone/playlist.m3u8" type='video/mp4'>
  </video>

  <script>
  </script>

</body>
</html>


推荐答案

而不是 type =' video / mp4'您需要 type ='application / x-mpegURL'

还检查是否允许跨域请求(CORS)。

Check also if cross-domain requests are allowed (CORS).


托管注意事项

与本地HLS实施不同,HLS技术必须遵守浏览器安全策略
。这意味着
组成流的所有文件必须与托管视频播放器的页面
相同的域提供,或者从配置了适当的CORS
标头的服务器提供。热门的
网络服务器提供简单的说明,大多数CDN应该可以在你的账户上以
开启CORS。

Unlike a native HLS implementation, the HLS tech has to comply with the browser's security policies. That means that all the files that make up the stream must be served from the same domain as the page hosting the video player or from a server that has appropriate CORS headers configured. Easy instructions are available for popular webservers and most CDNs should have no trouble turning CORS on for your account.



<来源: https://github.com/videojs/videojs-contrib-hls

CORS操作方法: http:// enable -cors.org/server.html

CORS How-To: http://enable-cors.org/server.html

这篇关于玩video.js ustream m3u8文件流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆