使用rtmp和videojs流式传输视频 [英] Stream video with rtmp and videojs

查看:440
本文介绍了使用rtmp和videojs流式传输视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种使用rtmp播放视频的方法。我使用video-js但它不起作用。 Firebug返回错误:

I looking for a way to stream play videos with rtmp. I use video-js but it doesn't work. Firebug return an error :

L'attribut « type » spécifié sur « video/flash » n'est pas géré. Le chargement de la ressource média rtmp://server.com/vod/mp4:foo/bar/my_video.mp4 a échoué.
VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) No compatible source was found for this video. MediaError { code=4,  message="No compatible source was found for this video."

HTML code:

HTML code :

<!doctype html>
<html lang="fr" class="no-js">
<head>
   <meta charset="UTF-8">
   <meta http-equiv="X-UA-Compatible" content="IE=edge" />
   <link rel="stylesheet" href="css/reset.css"> <!-- CSS reset -->
   <link rel="stylesheet" href="css/video-js.css"> <!-- Video.js -->
   <link rel="stylesheet" href="css/style.css"> <!-- Resource style -->
   <script src="js/modernizr.js"></script> <!-- Modernizr -->
   <title>Title</title>
</head>
<body class="sous-menu">
  <video id="example_video_1" class="video-js vjs-default-skin vjs-big-play-centered"
    controls preload="auto" width="640" height="264"
    data-setup='{"techOrder": ["flash", "html5"]}'>
    <source src="rtmp://server.com/vod/mp4:foo/bar/my_video.mp4" type='rtmp/mp4' />
  </video>
   <script src="js/jquery-2.1.4.min.js"></script> <!-- jQuery -->
   <script src="js/video-js.js"></script> <!-- Videojs.js -->
</body>
</html>

我做错了什么?

编辑: 我添加了 type ='rtmp / mp4'但它仍然无效......在FF,Chrome和& IE11。尝试了VLC中的链接并且它可以正常工作。

I add the type='rtmp/mp4' but it still dosen't work ... Test in FF, Chrome & IE11. Tried the link in VLC and it work.

推荐答案

使用类型 rtmp / mp4 在您的来源中。此外,video.js使用&符号来分隔服务器URL和流名称。 RTMP只适用于Flash可用的地方。

Use the type rtmp/mp4 in your source. Also, video.js uses an ampersand to separate the server URL and stream name. RTMP will only work where Flash is available of course.

<source src='rtmp://server.com/vod/&mp4:foo/bar/my_video.mp4' type='rtmp/mp4'/>

这篇关于使用rtmp和videojs流式传输视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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