[Qt-jambi-interest] MediaObject loop

Erwin Mueller devent.ml at deventm.org
Sun Aug 23 07:06:25 CEST 2009


Hi,
how can you implement a loop over a media file with MediaObject?
I followed the documentation:
	mediaObject.aboutToFinish.connect(this, 'audioFinished()')
	mediaObject.play()

    private audioFinished() {
    		println("audioFinished()")
    		QApplication.invokeLater({
    			println("mediaObject.play()")

			// case 1, but with the slot finished
    			//mediaObject.setCurrentSource(new
			//		MediaSource(outputFile.getAbsolutePath()))
    			//mediaObject.play()

			// case 2, with the slot aboutToFinish
    			mediaObject.enqueue(
				new MediaSource(outputFile.getAbsolutePath()))
    			//mediaObject.play() // to I need to call play() here?
        	})
    	
    }

I tried two ways, one with mediaObject.enqueue() and the slot aboutToFinish 
and the other with mediaObject.setCurrentSource() and the slot finished. Only 
the one with mediaObject.setCurrentSource() (case 1) works. Case 1 works, but 
you have a short pause in between the playback. Case 2 don't work at all, i.e. 
the first media source is played and nothing more. The slots are used/called 
as expected.

PS: The syntax is correct, it's groovy.
Using Qt Jambi, 4.5.2_01
-- 
Erwin Mueller, erwin.mueller at deventm.org
http://www.global-scaling-institute.de/
http://www.deventm.org



More information about the Qt-jambi-interest mailing list