You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.3 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>EasyWasmPlayer</title>
<script src="./EasyWasmPlayer.js"></script>
</head>
<body>
<div style="text-align: center;">
<div style="width:540px;height: 1170px; background-color:pink;margin: auto;display: inline-block;">
<div id="newplay1" onClick="onplay"></div>
<input type="text" id="value1" value="http://127.0.0.1:8080/live/h264.flv"
style="width: 80%;box-sizing: border-box;">
<button id="btn1" style="width: 18%;box-sizing: border-box;">播放</button>
</div>
<div style="width:540px;height: 1170px; background-color:pink;margin: auto;display: inline-block;">
<div id="newplay2" onClick="onplay"></div>
<input type="text" id="value2" value="http://127.0.0.1:8080/live/h265.flv"
style="width: 80%;box-sizing: border-box;">
<button id="btn2" style="width: 18%;box-sizing: border-box;">播放</button>
</div>
</div>
<script>
document.getElementById('value1').value=location.protocol + "//" +location.host + ":8080" +"/live/h264.flv";
document.getElementById('value2').value=location.protocol + "//" +location.host + ":8080" +"/live/h265.flv";
callbackfun = function (e) {
//console.log(e);
}
var player1;
var player2;
function play1() {
if (player1) {
player1.destroy();
}
player1 = new WasmPlayer(null, 'newplay1', callbackfun, {
Height: true
});
var url = document.getElementById('value1').value;
player1.play(url, 1);
}
btn1.onclick = function () {
play1();
}
function play2() {
if (player2) {
player2.destroy();
}
player2 = new WasmPlayer(null, 'newplay2', callbackfun, {
Height: true
});
var url = document.getElementById('value2').value;
player2.play(url, 1);
}
btn2.onclick = function () {
play2();
}
play1();
play2();
</script>
</body>
</html>