Pages

Open Source Media Framework: Playing video from a basic FlashMediaServer application instance

In OSFM (Open Source Media Framework) version5 the ability to streamvideo from a default Flash Media Server application instance was broken. It only worked if the stream-application folder on FMS was set up as a facsimile of the VOD directory, and the stream accessed with an absolute URI. The fix to access stream using the native FMS instance URI has been implemented in version 6. My thanks to the development team of the OSMF. This is the code you need to stream using the OSMF player and an application instance instead of a VOD set up with an absolute address.

package
{
import flash.display.Sprite;
import flash.events.NetStatusEvent;

import org.openvideoplayer.display.MediaPlayerSprite;
import org.openvideoplayer.events.LoadableStateChangeEvent;
import org.openvideoplayer.media.URLResource;
import org.openvideoplayer.net.NetLoadedContext;
import org.openvideoplayer.net.NetLoader;
import org.openvideoplayer.traits.ILoadable;
import org.openvideoplayer.traits.LoadState;
import org.openvideoplayer.traits.MediaTraitType;
import org.openvideoplayer.utils.FMSURL;
import org.openvideoplayer.video.VideoElement;


[SWF(width="640", height="352")]
public class HelloWorld extends Sprite
{
public function HelloWorld()
{



var sprite:MediaPlayerSprite = new MediaPlayerSprite();
addChild(sprite);

sprite.element = new VideoElement
( new NetLoader
, new URLResource(new FMSURL("rtmp://localhost/clearwater/darkwater/yourFLV-F4V",true))
);
}



}
}

Thanks to Will Law

aYo Binitie II

No comments:

Instagram