videojs / video.js

Video.js - open source HTML5 video player
https://videojs.com
Other
37.86k stars 7.43k forks source link

RTMP link in M3U playlist #5114

Closed sherif-fanous closed 6 years ago

sherif-fanous commented 6 years ago

Hi

Is it possible to directly play an RTMP link that is embedded in an M3U playlist. The following is the M3U playlist being served

`#EXTM3U

EXTINF:-1 ,Stream

rtmp://.....`

I have been unable to get this to play directly in videoJS 6.8.0 using either application/vnd.apple.mpegurl or rtmp/mp4 types.

My current workaround is to make an Ajax call to download the playlist then use m3u8-parser to parse out the rtmp link and feed that to videoJS with the rtmp/mp4 type.

Is there a better/more direct way of doing this?

Thanks in advance

gkatsev commented 6 years ago

you can probably use middleware to rewrite the source from the m3u to the rtmp url http://docs.videojs.com/tutorial-middleware.html#setsource) With a middleware set up to do the above (which would basically do what you're doing now) you'd be able to basically do something like:

player.src({
  src: 'myplaylist.m3u',
  type: 'rtmp/m3u'
});

then have your middleware look for rtmp/m3u urls. Hope that helps.