zhgdlarge/src/components/ysyPlayAndPlayback.vue

39 lines
1.3 KiB
Vue

<template>
<!-- &begin=20200915&end=20200915 &-->
<!-- autoplay=1 传这个默认一开始是查看历史回放 -->
<iframe
:src="'https://open.ys7.com/ezopen/h5/iframe_se?url=' + ysyParams.url + '&accessToken=' + ysyParams.token"
width="100%"
height="100%"
id="ysOpenDevice"
allowfullscreen
>
</iframe>
</template>
<script>
export default {
data() {},
props: ["ysyParams"],
mounted() {
this.init2();
},
methods: {
init2() {
console.log("init2");
/* 获取播放器元素 */
var player = document.getElementById("ysOpenDevice").contentWindow;
/* iframe 支持方法 */
player.postMessage("play", "https://open.ys7.com/ezopen/h5/iframe"); /* 播放 */
player.postMessage("stop", "https://open.ys7.com/ezopen/h5/iframe"); /* 结束 */
player.postMessage("capturePicture", "https://open.ys7.com/ezopen/h5/iframe"); /* 截图 */
player.postMessage("openSound", "https://open.ys7.com/ezopen/h5/iframe"); /* 开启声音 */
player.postMessage("closeSound", "https://open.ys7.com/ezopen/h5/iframe"); /* 关闭声音 */
player.postMessage("startSave", "https://open.ys7.com/ezopen/h5/iframe"); /* 开始录制 */
player.postMessage("stopSave", "https://open.ys7.com/ezopen/h5/iframe"); /* 结束录制 */
}
}
};
</script>
<style lang="scss" scoped>
</style>