How to get State of a live stream in VLC web Plugin?

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
alex12
New Cone
New Cone
Posts: 7
Joined: 30 Jun 2016 16:21

How to get State of a live stream in VLC web Plugin?

Postby alex12 » 30 Jun 2016 16:31

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.

da2424
Cone that earned his stripes
Cone that earned his stripes
Posts: 310
Joined: 16 Apr 2013 16:57

Re: How to get State of a live stream in VLC web Plugin?

Postby da2424 » 01 Jul 2016 12:21

Have you used vlc.playlist.isPlaying?

alex12
New Cone
New Cone
Posts: 7
Joined: 30 Jun 2016 16:21

Re: How to get State of a live stream in VLC web Plugin?

Postby alex12 » 01 Jul 2016 18:35

Yes!
And it always returns a true, even the stream is not playing.
Is that because it's a live stream?

da2424
Cone that earned his stripes
Cone that earned his stripes
Posts: 310
Joined: 16 Apr 2013 16:57

Re: How to get State of a live stream in VLC web Plugin?

Postby da2424 » 01 Jul 2016 19:04

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'.

alex12
New Cone
New Cone
Posts: 7
Joined: 30 Jun 2016 16:21

Re: How to get State of a live stream in VLC web Plugin?

Postby alex12 » 01 Jul 2016 19:28

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+

da2424
Cone that earned his stripes
Cone that earned his stripes
Posts: 310
Joined: 16 Apr 2013 16:57

Re: How to get State of a live stream in VLC web Plugin?

Postby da2424 » 01 Jul 2016 19:43

You could try it with the event 'MediaPlayerEncounteredError', but in this case, it also will not work always.

da2424
Cone that earned his stripes
Cone that earned his stripes
Posts: 310
Joined: 16 Apr 2013 16:57

Re: How to get State of a live stream in VLC web Plugin?

Postby da2424 » 01 Jul 2016 19:49

I have looked again, vlc.input.state will work. It will return 6 (ended)

alex12
New Cone
New Cone
Posts: 7
Joined: 30 Jun 2016 16:21

Re: How to get State of a live stream in VLC web Plugin?

Postby alex12 » 01 Jul 2016 23:47

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.

da2424
Cone that earned his stripes
Cone that earned his stripes
Posts: 310
Joined: 16 Apr 2013 16:57

Re: How to get State of a live stream in VLC web Plugin?

Postby da2424 » 02 Jul 2016 21:21

Probably it's my testcase which is different.
You could try VLC v3 nightlies, but no clue if there is the same problem.

alex12
New Cone
New Cone
Posts: 7
Joined: 30 Jun 2016 16:21

Re: How to get State of a live stream in VLC web Plugin?

Postby alex12 » 04 Jul 2016 16:02

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!


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 13 guests