guifei zhu
2024-09-18 ba616e9307681da4781b7610ec3c27721d793379
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
<template>
    <view>
        <view id="video-container1" class="item-player">
 
        </view>
    </view>
</template>
 
<script>
    import EZUIKit from "ezuikit-js";
    export default {
        data() {
            return {
 
            }
        },
        mounted() {
            this.initPlayer1()
 
        },
        methods: {
            initPlayer1() {
                var width = document.documentElement.clientWidth;
                var height = document.documentElement.clientWidth * 9 / 16;
                const player1 = new EZUIKit.EZUIKitPlayer({
                    id: "video-container1", // 视频容器ID
                    accessToken: 'at.3aw83ov4az77j8s87flvj2a36lctx64d-7awt1ntwzz-024wi8h-bpwhdobad',
                    url: 'ezopen://open.ys7.com/C24284281/1.hd.live',
                    template: 'mobileLive',
                    plugin: ["talk"], // 加载插件,talk-对讲
                    width: width,
                    height: height,
                    handleSuccess: (res => {
                        console.info(res);
                        console.info("初始化成功");
                    }),
                    handleError: (res => {
                        console.info(res);
                        if (res.retcode == "10002") {
                            console.info("初始化失败,token过期");
                        }
                    })
                });
                setTimeout(() => {
                    console.info("开始自动播放1号")
                    player1.play();
                }, 1000);
            }
 
        }
    }
</script>
 
<style>
 
</style>