q-video events
-
Hi folks, is it possible to receive events from the q-video component? I was reading the API here: https://developers.google.com/youtube/iframe_api_reference?csw=1 and it seems its possible to have events from the iframe player.
So I tried
<q-video :ratio="16/9" :src="embedUrl(video.id)" @v-on:onStateChange="changeState" ></q-video>
But its not working. Any way to capture when a video started playing event?
Thank you
-
@vinnyc All native events seem to be propagated, so should be working. Have you tried @v-on:stateChange=“changeState” by any chance?
-
@Ilia tried that too, won’t work either, but thanks for the suggestion
-
@vinnyc This is wrong:
@v-on:onStateChange="changeState"
Either use:v-on:onStateChange="changeState"
or use:@onStateChange="changeState"
@
is an alias forv-on
, so you essentially hadv-onv-on
-
On the copy/past frenzy I did not noticed that I pasted it wrong:
<q-video :ratio="16/9" :src="embedUrl(video.id)" @onStateChange="changeState" ></q-video>
or
<q-video :ratio="16/9" :src="embedUrl(video.id)" v-on:onStateChange="changeState" ></q-video>
Are both not working folks
-
Well at least the method never gets called for things like play/pause/volume change, which is what I was expecting, maybe I misunderstood the OnStateChange method?
-
I don’t know YouTube api. I presume
onStateChange
comes from them? -
@vinnyc This may or may not be of help. This is a list of Media Events that should be available to q-video. My understanding is that q-video is just a wrapper around HTML5 video.
I quickly outgrew HTML5 video and moved on to videojs.
-
My understanding is that q-video is just a wrapper around HTML5 video.
Yeah, that’s not true. QMediaPlayer is. QVideo is basically just an iFrame needed for embedding things like YouTube (at least, that was the intension). The name is slightly misleading. Also to note, QMediaPlayer doesn’t do YouTube as YouTube have their own protocols.
-
Thank you all for the help. @Hawkeye64 yes from my understanding of youtube’s api that’s the method, but looks like you need to register for the event to be propagated.