Here's a screenshot of the working example:
Here's the source required to run the video:
package org.sgine.ui
import org.sgine.core.Resource
import org.sgine.render.Renderer
import org.sgine.render.scene.RenderableScene
import org.sgine.scene.GeneralNodeContainer
import org.sgine.scene.ext.ResolutionNode
object TestMediaPlayer {
def main(args: Array[String]): Unit = {
val r = Renderer.createFrame(640, 480, "Test MediaPlayer")
val scene = new GeneralNodeContainer() with ResolutionNode
scene.setResolution(640, 480)
val component = new MediaPlayer()
val url = new java.net.URL("http://sun.edgeboss.net/download/sun/media/1460825906/1460825906_2956241001_big-buck-bunny-640x360.flv")
component.source := Resource(url)
scene += component
r.renderable := RenderableScene(scene)
component.play()
}
}As always the goal is to keep the API as simple as possible and hopefully 27 total lines of code is simplistic enough. :)
There's still much left to do as far as introspection and control of video playing as well as controls to allow user interaction with the player, but we've finally got a fast and reliable means of playing all popular audio and video formats and I will probably divert back to more important work for a while. :)