Page 1 of 1
How to get State of a live stream in VLC web Plugin?
Posted: 30 Jun 2016 16:31
by alex12
Hi,
I embed a VLC Web Plugin in a web application asp.net.
The VLC is playing a live stream RTSP.
How to get an alert when the stream stops playing?
I used "vlc.isPlaying " but is always returning true even if the stream is stopped.
Thanks.
Re: How to get State of a live stream in VLC web Plugin?
Posted: 01 Jul 2016 12:21
by da2424
Have you used vlc.playlist.isPlaying?
Re: How to get State of a live stream in VLC web Plugin?
Posted: 01 Jul 2016 18:35
by alex12
Yes!
And it always returns a true, even the stream is not playing.
Is that because it's a live stream?
Re: How to get State of a live stream in VLC web Plugin?
Posted: 01 Jul 2016 19:04
by da2424
It should always return the correct state.
But yes, if the connection to the server will be lost while playing, the state will still be true.
If the stream was stopped with vlc.playlist.stop() or over the UI, you can catch it with the event 'MediaPlayerStopped'.
Re: How to get State of a live stream in VLC web Plugin?
Posted: 01 Jul 2016 19:28
by alex12
The idea of my site, is to play a live stream, and when the connection is lost with server, the program should notify the developer with the issue.
There is no events, The program should treat the state every 5 minutes and return true or false.
So, what you're saying, is that I will not be able to get notified when stream occurs a problem??
Is there is another solution for this?
I even try to get the frame's number with vlc.playlist.fps and it is always returning 0.
A+
Re: How to get State of a live stream in VLC web Plugin?
Posted: 01 Jul 2016 19:43
by da2424
You could try it with the event 'MediaPlayerEncounteredError', but in this case, it also will not work always.
Re: How to get State of a live stream in VLC web Plugin?
Posted: 01 Jul 2016 19:49
by da2424
I have looked again, vlc.input.state will work. It will return 6 (ended)
Re: How to get State of a live stream in VLC web Plugin?
Posted: 01 Jul 2016 23:47
by alex12
Really?
It is strange. why it does not work for me?
I have the function below to notify me when a new state come. For Pause and Play it notify the right state (3 and 4), but when I stop the server application stream it returns the last state (3 or 4), it never return 6.
var start_timer = setInterval(function () {
var vlc = getVLC("vlc");
var s = vlc.input.state;
alert(s);
}, 6000);
Any way, thanks for your help.
Re: How to get State of a live stream in VLC web Plugin?
Posted: 02 Jul 2016 21:21
by da2424
Probably it's my testcase which is different.
You could try VLC v3 nightlies, but no clue if there is the same problem.
Re: How to get State of a live stream in VLC web Plugin?
Posted: 04 Jul 2016 16:02
by alex12
it is finally working with the code shown in my last post.
it returns an ENDED state.
I should have waited a little while before program recognize the new state, around 60 seconds instead of 6 seconds.
Thanks man!