Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

MediaPlayerStateChanged should fire only on real state change #113

Open
jaruba opened this issue Apr 23, 2015 · 11 comments
Open

MediaPlayerStateChanged should fire only on real state change #113

jaruba opened this issue Apr 23, 2015 · 11 comments
Milestone

Comments

@jaruba
Copy link

jaruba commented Apr 23, 2015

MediaPlayerStateChanged does not trigger for the buffering state. See this demo:

http://editor.webchimera.org/c/1429781968

@RSATom
Copy link
Owner

RSATom commented Apr 23, 2015

hm... strange, it should (I've checked the sources). Ok, will look close a little later. Thanks!

@RSATom RSATom added the bug label Apr 23, 2015
@jaruba
Copy link
Author

jaruba commented Apr 23, 2015

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?

@RSATom
Copy link
Owner

RSATom commented Apr 23, 2015

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.

@RSATom
Copy link
Owner

RSATom commented Apr 23, 2015

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 MediaPlayerBufferingevent, after that you will get MediaPlayerStateChanged since one triggers another.

@jaruba
Copy link
Author

jaruba commented Apr 23, 2015

Does MediaPlayerStateChanged also pass the new state to the callback function?

@RSATom
Copy link
Owner

RSATom commented Apr 23, 2015

Don't sure I understand what you mean.

@jaruba
Copy link
Author

jaruba commented Apr 23, 2015

If something like MediaPlayerStateChanged( state ) is possible. so it would pass the new state when the event is triggered.

@RSATom
Copy link
Owner

RSATom commented Apr 23, 2015

no, since I have only async access to state. I.e. it will have the same problem.

@RSATom
Copy link
Owner

RSATom commented Apr 23, 2015

but stop, you are right, I can deduce current state from original event. Good Idea.

@jaruba jaruba closed this as completed Apr 23, 2015
@RSATom RSATom reopened this Apr 23, 2015
@RSATom RSATom added enhancement and removed bug labels Apr 23, 2015
@RSATom RSATom closed this as completed in 1d145a0 Apr 28, 2015
@RSATom RSATom added this to the 0.2.8 milestone Apr 28, 2015
@jaruba
Copy link
Author

jaruba commented May 18, 2015

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.

@RSATom
Copy link
Owner

RSATom commented May 19, 2015

Yes, I didn't store previous state value

@RSATom RSATom removed this from the 0.2.8 milestone May 19, 2015
@RSATom RSATom reopened this May 19, 2015
@RSATom RSATom changed the title MediaPlayerStateChanged Buffering MediaPlayerStateChanged should fire only on real state change May 19, 2015
@RSATom RSATom added this to the 0.2.9 milestone May 22, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants