Html – Playing RTMP stream with VideoJS player

htmlrtmpvideo streamingvideo.js

I'm trying to play RTMP stream with VideoJS player, below is my code:

<head>
  <link href="http://vjs.zencdn.net/6.2.0/video-js.css" rel="stylesheet">

  <!-- If you'd like to support IE8 --> 
  <script src="http://vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"></script>
</head>

<body>
  <video id="my-video" class="video-js" controls preload="auto" width="640" height="264" data-setup='{"techorder" : ["flash"]}'>
    <source src="rtmp://184.72.239.149/vod/mp4/BigBuckBunny_115k.mov" type="rtmp/mp4">                                                                                                                           
    <p class="vjs-no-js">
      To view this video please enable JavaScript, and consider upgrading to a web browser that
      <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
    </p>
  </video>

  <script src="http://vjs.zencdn.net/6.2.0/video.js"></script>
</body>

The error I'm seeing is this:

VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) No compatible source was found for this media. MediaError {code: 4, message: "No compatible source was found for this media."}

The error is quite clear, but there are plenty of docs showing people success stories of playing RTMP streams with VideoJS:

I know for sure that the following URL does play on VLC player and so does it on JWPlayer:

rtmp://184.72.239.149/vod/mp4/BigBuckBunny_115k.mov

What could be the problem?

Best Answer

If you wanna play RTMP you must include flash-tech which can be retrieved from here:

https://github.com/videojs/videojs-flash

Hence correct code would be this:

<head>
  <link href="http://vjs.zencdn.net/6.2.0/video-js.css" rel="stylesheet">

  <!-- If you'd like to support IE8 --> 
  <script src="http://vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"></script>
</head>

<body>
  <video id="my-video" class="video-js" controls preload="auto" width="640" height="264" data-setup='{"techorder" : ["flash"]}'>
    <source src="rtmp://184.72.239.149/vod/mp4/BigBuckBunny_115k.mov" type="rtmp/mp4">                                                                                                                           
    <p class="vjs-no-js">
      To view this video please enable JavaScript, and consider upgrading to a web browser that
      <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
    </p>
  </video>

  <script src="http://vjs.zencdn.net/6.2.0/video.js"></script>
  <script src="/videojs-flash.js"></script>
</body>
Related Topic