2024-06-05 16:16:58 +08:00
|
|
|
|
<!doctype html>
|
|
|
|
|
|
<html>
|
|
|
|
|
|
<head>
|
|
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
|
<script src="./h5player.min.js"></script>
|
|
|
|
|
|
<style type="text/css">
|
|
|
|
|
|
.myplayer {
|
2024-06-07 10:56:32 +08:00
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 300px;
|
|
|
|
|
|
/* border-radius: 2vh; */
|
2024-06-05 16:16:58 +08:00
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
/* background: #000; */
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|
|
|
|
|
|
</head>
|
|
|
|
|
|
<body>
|
|
|
|
|
|
<div id="play_window" class="myplayer"></div>
|
|
|
|
|
|
<script>
|
|
|
|
|
|
// 这里写js业务代码
|
|
|
|
|
|
// 初始化插件
|
|
|
|
|
|
var myPlugin = new JSPlugin({
|
|
|
|
|
|
szId: 'play_window', //需要英文字母开头 必填
|
2024-06-07 10:56:32 +08:00
|
|
|
|
szBasePath: './', // 必填,引用H5player.min.js的js相对路径
|
2024-06-05 16:16:58 +08:00
|
|
|
|
iCurrentSplit: 1,
|
|
|
|
|
|
})
|
|
|
|
|
|
// 获取视频播放流
|
|
|
|
|
|
var playURL = GetQueryString("cameraUrl")
|
|
|
|
|
|
console.log("222",playURL);
|
|
|
|
|
|
// 有视频流地址以后,才进行播放
|
|
|
|
|
|
if(playURL){
|
|
|
|
|
|
// 窗口下标
|
|
|
|
|
|
var curIndex = 0;
|
|
|
|
|
|
// 获取监控点唯一标识,方便作为抓图存储的key
|
|
|
|
|
|
var cameraIndexCode = GetQueryString("cameraIndexCode")
|
|
|
|
|
|
// 视频预览
|
|
|
|
|
|
myPlugin.JS_Play(playURL, {
|
|
|
|
|
|
playURL,
|
|
|
|
|
|
mode: 1
|
|
|
|
|
|
}, curIndex).then(() => {
|
|
|
|
|
|
console.info('JS_Play success 播放成功');
|
|
|
|
|
|
// do you want...
|
|
|
|
|
|
// 抓图
|
|
|
|
|
|
var fileName = 'img';
|
|
|
|
|
|
var fileType = 'JPEG';
|
|
|
|
|
|
//不进行下载,数据回调
|
|
|
|
|
|
myPlugin.JS_CapturePicture(curIndex, fileName, fileType,imageData => {
|
|
|
|
|
|
console.info('JS_CapturePicture success 抓图成功'); //2.1.0开始全是base64,之前的版本存在blob或者是base64
|
|
|
|
|
|
// do you want...
|
2024-06-07 10:56:32 +08:00
|
|
|
|
// plus.storage.setItem(cameraIndexCode,imageData);
|
2024-06-05 16:16:58 +08:00
|
|
|
|
})
|
|
|
|
|
|
}, (err) => {
|
|
|
|
|
|
console.info('JS_Play failed:', err);
|
|
|
|
|
|
// do you want...
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//取url中的参数值
|
|
|
|
|
|
function GetQueryString(name) {
|
|
|
|
|
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
|
|
|
|
|
var r = window.location.search.substr(1).match(reg);
|
|
|
|
|
|
if (r != null) return unescape(r[2]);
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2024-06-07 10:56:32 +08:00
|
|
|
|
function wholeFullScreen(){
|
|
|
|
|
|
myPlugin.JS_FullScreenDisplay(true).then(
|
|
|
|
|
|
() => { console.log(`wholeFullScreen success`) },
|
|
|
|
|
|
e => { console.error(e) }
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
myPlugin.JS_SetWindowControlCallback({
|
|
|
|
|
|
windowFullCcreenChange: function (bFull) { //全屏切换回调
|
|
|
|
|
|
console.log('fullScreen callback: ', bFull);
|
|
|
|
|
|
window.parent.postMessage("childLoaded", "*");
|
|
|
|
|
|
},
|
|
|
|
|
|
})
|
|
|
|
|
|
// wholeFullScreen()
|
|
|
|
|
|
|
2024-06-05 16:16:58 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
</body>
|
|
|
|
|
|
</html>
|