Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
595 views
in Technique[技术] by (71.8m points)

vue-video-player 怎么监控开始播放和结束事件

我想有个需求就是必须登陆能才能看视频,所以要再它点播放时判断它有登陆时再继续。

但是看了vue-video-player的文档不是很明白

vue-video-player

<video-player :options="videoOptions" @my-player-state-changed-event-custom-name="playerStateChanged" ref="myPlayer"></video-player>

videoOptions: {
                  source: {
                    type: "video/webm",
                    src: 'https://cdn.theguardian.tv/webM/2015/07/20/150716YesMen_synd_768k_vp8.webm',

                  },
                  autoplay: false,
                  language: 'zh-CN',
                  play: 'my-player-state-changed-event-custom-name'
                }

computed: {
          player() {
            return this.$refs.myPlayer.player
          }
        },
        
         methods:{
          playerStateChanged(playerCurrentState) {
            console.log(playerCurrentState);
          }
        },

我这样并不生效,求正确写法


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...