FenXiNspBigScreen/public/EasyPlayer/demo/html/index.html

51 lines
1.8 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>EasyPlayer</title>
<script src="./jquery.min.js"></script>
<script src="./EasyPlayer-element.min.js"></script>
</head>
<style>
#player .easy-player {
height: 400px;
position: relative;
}
</style>
<body>
<h4 style="width:600px;margin: auto;">EasyPlayer播放器</h4>
<br>
<div style="width:600px; height: 400px;position: relative;">
<easy-player id="player" live="true" show-custom-button="true" isH265="true" ></easy-player>
<p>列如http://127.0.0.1:8080/flv/hls/stream.flv <a href="http://www.easydarwin.org/easyplayer/" target="_blank"> 在线演示</a></p>
<p style="color:red;font-size: 12px;">注意:本实例需要以服务方式启动 <a href="https://blog.csdn.net/weixin_43194037/article/details/108885134" target="_blank">搭建服务教程</a></p>
<input type="text" id="value">
<button id="btn">播放</button>
<button id="btnSnap">快照</button>
</div>
<script>
let vuePlayer = null
var btn = document.getElementById('btn');
var btnSnap = document.getElementById('btnSnap');
let player = document.getElementById('player')
// 地址栏
var value = document.getElementById('value');
//播放事件 传入地址播放
btn.onclick = function(){
console.log('player', player)
$('#player').attr('video-url',value.value)
}
btnSnap.onclick = function(){
if (!vuePlayer) vuePlayer = player.getVueInstance(); // 获取播放器实例
var attrs = player.attributes;
console.log('player', vuePlayer)
vuePlayer.snapshot()
}
</script>
</body>
</html>