1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
| <template> <div class="hello-ezuikit-js"> <div id="video-container" style="width:600px;height:400px"></div> <div> <button v-on:click="stop">stop</button> <button v-on:click="play">play</button> <button v-on:click="openSound">openSound</button> <button v-on:click="closeSound">closeSound</button> <button v-on:click="startSave">startSave</button> <button v-on:click="stopSave">stopSave</button> <button v-on:click="capturePicture">截图</button> <button v-on:click="fullScreen">fullScreen</button> <button v-on:click="getOSDTime">getOSDTime</button> <button v-on:click="ezopenStartTalk">开始对讲</button> <button v-on:click="ezopenStopTalk">结束对讲</button> <button v-on:click="destroy">销毁</button> </div> </div> </template>
<script> import EZUIKit from "ezuikit-js"; var player = null;
export default { name: "HelloWorld", props: { msg: String }, mounted: () => { console.group("mounted 组件挂载完毕状态===============》"); // fetch('https://open.ys7.com/jssdk/ezopen/demo/token') // .then(response => response.json()) // .then(res => { // }); player = new EZUIKit.EZUIKitPlayer({ id: 'video-container', // 视频容器ID accessToken: 'at.8p2tzm1scxfzap3iai3e3z2tdx7zkfxp-1lbh1gmg25-1diiijy-habfxazjq', url: 'ezopen://open.ys7.com/K93932450/1.hd.live', // simple - 极简版; pcLive-pc直播;pcRec-pc回放;mobileLive-移动端直播;mobileRec-移动端回放;security - 安防版;voice-语音版; //template: 'simple', plugin: ['talk'], // 加载插件,talk-对讲 width: 600, height: 400, }); window.player = player; }, methods: { play() { var playPromise = player.play(); playPromise.then((data) => { console.log("promise 获取 数据", data) }) }, stop() { var stopPromise = player.stop(); stopPromise.then((data) => { console.log("promise 获取 数据", data) }) }, getOSDTime() { var getOSDTimePromise = player.getOSDTime(); getOSDTimePromise.then((data) => { console.log("promise 获取 数据", data) }) }, capturePicture() { player.capturePicture(0, (res) => { console.log("图片base64", res.base64) }, false); }, openSound() { var openSoundPromise = player.openSound(); openSoundPromise.then((data) => { console.log("promise 获取 数据", data) }) }, closeSound() { var openSoundPromise = player.closeSound(); openSoundPromise.then((data) => { console.log("promise 获取 数据", data) }) }, startSave() { var startSavePromise = player.startSave(`${new Date().getTime()}`); startSavePromise.then((data) => { console.log("promise 获取 数据", data) }) }, stopSave() { var stopSavePromise = player.stopSave(); stopSavePromise.then((data) => { console.log("promise 获取 数据", data) }) }, ezopenStartTalk() { player.startTalk(); }, ezopenStopTalk() { player.stopTalk(); }, fullScreen() { player.fullScreen(); }, destroy() { var destroyPromise = player.destroy(); destroyPromise.then((data) => { console.log("promise 获取 数据", data) }) } } }; </script>
|