V
V
Vorchun2013-07-08 11:36:47
Video
Vorchun, 2013-07-08 11:36:47

How to determine if there is a video broadcast on the site?

The company's server is hosted by Adobe flash media streaming server. On the site - JWPlayer

The task is to show the player only when there is a video broadcast.

The server is not shutting down. Those. there is no point in pinging him.

Now we did this: we connect the stream to the JWPlayer. Waiting for a second to load. If the stream has not loaded, we react to the event - we hide the player. This is very suboptimal.

What do you think?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
X
xmoonlight, 2013-07-08
@xmoonlight

Did you try to check the connection to the stream port on the server side at the time of page generation?
Another option is to check the port via xmlhttprequest on the client side. ( xmlhttprequest.ru ) and show the player only by code 200.

A
Alexander Borisovich, 2013-07-08
@Alexufo

Scheduled broadcast?

V
Vorchun, 2013-07-08
@Vorchun

Alexufo , and done. About this and the question) Google, so far, has not helped in any way, maybe someone here with experience in such a matter

M
Mu57Di3, 2013-07-08
@Mu57Di3

JWPlayer has an API forwarded to JavaScript from Flash and there it is possible to subscribe to an error event, including an error in accessing the video stream, more details here .

J
jov, 2013-07-09
@jov

I'm at home, to check for the presence of a stream, I do this.

rate=$(timeout 5 ffprobe "rtmp://localhost/live/rrstudio" 2>&1 | grep framerate | awk '{printf "%d", $2}')
    if [ -z "$rate" ]; then
        		echo "$d: need restart - null rate $rate" >> /var/log/upstart/rrvideo.log
        		service rrvideo restart		
    elif [ $rate -lt 25 ]; then
        		echo "$d: need restart - $rate" >> /var/log/upstart/rrvideo.log
        		service rrvideo restart
    fi

Run a similar script in cron and let it modify the page with the player.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question