<html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"> <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" /> <title>RTSP视频</title> <script src="libs/adapter.min.js" ></script> <script src="webrtcstreamer.js" ></script> <script src="webrtcstreamer.json" ></script> <script src="libs/jquery-2.1.1.min.js" ></script> <script> var webRtcServerList = {}; var urllist=[ {"tags":"Bunny","urls":"Guodao"} ]; var webRtcServer = null; function add(tags,urls){ var options = webrtcConfig.options; $("#videolist").append("<div class='videomv'><video id='video"+tags+"' muted autoplay controls/><p>"+tags+"</p></div>"); webRtcServer = new WebRtcStreamer("video"+tags,webrtcConfig.url); webRtcServer.connect(urls,urls,options); webRtcServerList[tags] = webRtcServer; } window.onload = function() { urllist.forEach(function(value,index,array){ add(value["tags"],value["urls"]) }); } window.onbeforeunload = function() { for (var url in webRtcServerList) { webRtcServerList[url].disconnect() } }; </script> <style> .videomv{ width: 100%; height: 500px; margin-bottom: 20px; float: left; text-align: center; } .videomv video{ width: 100%; height: 300px; } </style> </head> <body> <div id="videolist"> </div> </body> </html>
发表评论 取消回复