You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.5 KiB
HTML
47 lines
1.5 KiB
HTML
<html>
|
|
<script src="webrtcplayer.js"></script>
|
|
<script src="jquery.min.js"></script>
|
|
<body>
|
|
<!-- <video id="camera1" class="camera" autoplay controls muted style="width:700px;"></video>
|
|
<video id="camera2" class="camera" autoplay controls muted style="width:700px;"></video> -->
|
|
</body>
|
|
<script>
|
|
|
|
var body = document.querySelector('body');
|
|
$(function(){
|
|
let ip ;
|
|
$.getJSON("config.json", function (data){
|
|
console.log(data)
|
|
ip = data["serverIp"]
|
|
let webRtc = data["webRtcIp"]
|
|
WebRtcPlayer.setServer(webRtc);
|
|
$.ajax({
|
|
url:ip+'/api/realTime/allCameras',
|
|
type:'get',
|
|
data:{},
|
|
dataType:'json',
|
|
success:function(data){
|
|
for(camera of data.data){
|
|
var video = document.createElement('video')
|
|
video.setAttribute('id',camera.id)
|
|
video.autoplay = true
|
|
video.controls = true
|
|
video.muted = true
|
|
video.style = 'width:700px;'
|
|
video.setAttribute('class','video')
|
|
body.appendChild(video)
|
|
let player = new WebRtcPlayer(camera.id,'camera'+camera.id);
|
|
player.load('camera'+camera.id)
|
|
}
|
|
},
|
|
error:function(){
|
|
console.log('请求出错!');
|
|
}
|
|
})
|
|
});
|
|
|
|
|
|
});
|
|
|
|
</script>
|
|
</html> |