video.js - How to play rtmp live stream using videojs? -
i'm using obs push live stream local rtmp server(node-rtsp-rtmp-server), , works vlc media player. want put webpage , found videojs. didnt work , returns specified “type”-attribute “rtmp/mp4” not supported. seems rtmp server didnt reveive requests webpage. missed? here code:
<head> <meta charset="utf-8"> <link href="./video-js-6.0.0/video-js.css" rel="stylesheet"> <script src="./video-js-6.0.0/video.js"></script> <script src="./video-js-6.0.0/videojs-flash.min.js"></script> <script> videojs.options.flash.swf = "./video-js-6.0.0/video-js.swf" </script> </head> <body> <video id='vid' class='video-js' controls height=300 width=600> <source src="rtmp://127.0.0.1:1935/live/pokemon" type="rtmp/mp4"/> </video> <script> var player = videojs('vid'); </script> </body>
this works me
<html> <head> <title> stream player </title> <link href="video-js.css" rel="stylesheet" type="text/css"> <script src="video.js"></script> <script> videojs.options.flash.swf = "video-js.swf"; </script> </head> <body> <center> <video id="livestream" class="video-js vjs-default-skin vjs-big-play- centered" controls autoplay preload="auto" width="600" height="300" data-setup='{"techorder" : ["flash"] }'> <source src="rtmp://10.0.0.35:1935/live/test" type="rtmp/mp4"> </video> </center> </body> </html>
looks might have '/' typo in type. data-setup techorder parameter seems necessary videojs use flash.
if doesnt work make sure javascript files good.
i using nginx server.
https://obsproject.com/forum/resources/how-to-set-up-your-own-private-rtmp-server-using-nginx.50/
Comments
Post a Comment