nstudio / nativescript-videoplayer

:clapper: Video Player widget for NativeScript apps
MIT License
132 stars 59 forks source link

How to listen events in nativescript-vue app #143

Open robertoandres24 opened 5 years ago

robertoandres24 commented 5 years ago

i've tried, but didnt work

<template>
  <VideoPlayer
    @playbackStartEvent="onStart"
    class="video"
    ref="player"
    :src="src"
    autoplay="false"
    controls="true"
    fill="true"
  />
</template>
<script>
export default {
  props: {
    src: {
      default: '~/assets/videos/big_buck_bunny.mp4'
    }
  },

  methods: {
    onStart() {
      console.log('started video playback')
    }
  }
}
</script>

also a similar to the way that in angular does but neither results

  mounted() {
    let player = this.$refs.player.nativeView
    player.on('playbackStartEvent', args => {
      console.log('playbackStartEvent executed')
    })
  },

Update

Finally I have been able to capture the event. this.player = this.$refs.player.nativeView but with the following issues IOS

doesnt work

    this.player.on('playbackReadyEvent', () => {
      console.log('Video is ready')
    })
    this.player.on('playbackStartEvent', () => {
      console.log('Video has been started.')
    })
    this.player.on('pausedEvent', () => {
      console.log('Video has been paused.')
    })

works as expected

    this.player.on('finishedEvent', () => {
      console.log('Video has been finished.')
    })

ANDROID

doesnt work

    this.player.on('playbackReadyEvent', () => {
      console.log('Video is ready')
    })
    this.player.on('playbackStartEvent', () => {
      console.log('Video has been started.')
    })

works as expected

    this.player.on('pausedEvent', () => {
      console.log('Video has been paused.')
    })
    this.player.on('finishedEvent', () => {
      console.log('Video has been finished.')
    })

By the way, thanks to creator for this plugin, its made me possible integrates video player to the project in my job. but please if its possible solution this bugs. regards

rnmhdn commented 4 years ago

Any update on this?