WebChimera
WebChimera copied to clipboard
MediaPlayerStateChanged should fire only on real state change
MediaPlayerStateChanged
does not trigger for the buffering state. See this demo:
http://editor.webchimera.org/c/1429781968
hm... strange, it should (I've checked the sources). Ok, will look close a little later. Thanks!
then maybe it's something with .state
? could it be it doesn't change to 2 (buffering)? or maybe .state
is changed to 2 after the buffering event is triggered?
I think .state
could skip some state if change was happen very quickly, since state event not tied strong with .state value. And there could be some delay in .state update. Events in this case are more reliable.
The reason is I emit MediaPlayerStateChanged
not when .state
value was changed (I have no control over it), but when some related event arrive: https://github.com/RSATom/QmlVlc/blob/master/QmlVlcPlayerProxy.cpp#L50
So if you get MediaPlayerBuffering
event, after that you will get MediaPlayerStateChanged
since one triggers another.
Does MediaPlayerStateChanged
also pass the new state to the callback function?
Don't sure I understand what you mean.
If something like MediaPlayerStateChanged( state )
is possible. so it would pass the new state when the event is triggered.
no, since I have only async access to state. I.e. it will have the same problem.
but stop, you are right, I can deduce current state from original event. Good Idea.
There is one more problem with MediaPlayerStateChanged
that I've found. I guess it should trigger only when the state has changed (ie: is different from the previous state), but I added a console.log()
to the event and it's triggering a lot more times for the same exact states in a row.
Yes, I didn't store previous state value