Making a Java InputStream Video Player

Enrique Ocaña González eocanha at igalia.com
Fri Jul 1 15:36:59 UTC 2016


El Viernes, 1 de julio de 2016 16:55:05 Nicolas Castillejos escribió:

> > You can find a zip at this address :
> > http://nicolas.castillejos.free.fr/InputStreamJavaPlayer.zip
>
> 1) setLive(true) on the AppSrc
> 2) Listen Bus messages : when the Video Bin Element State goes to
> GST_STATE_PAUSED , I do a "pipe.pause();" then "pipe.play();"
>
> For me it looks like a hack ... why do I have to do this ?

I don't know much about the peculiarities of gstreamer-java, but there's 
something really weird in the code of your zip file: You never call 
"Gst.main()"!

GStreamer (and GLib/GObject) are event-driven. This means that the main 
program must engage in a loop at some point (the "main loop") and keep looping 
there indefinitely. API calls made by your program will change things here and 
there. Some changes will trigger events and the main loop will call to the 
functions you have defined to attend them (event handlers). At some point, one 
of your event handlers will decide to stop the loop and exit, the main loop 
will break, and your main program will continue its course.

Gst.main() is the function which enters into the main loop and keeps there 
forever. You need to call it, at the very least, after player.play().

I hope it helps.

-- 
Enrique Ocaña González


More information about the gstreamer-devel mailing list