Playing Flv Android
Can we play flv stream videos in Android without using WebView, it's too slow? I mean play .flv video directly from url. Any ideas? VideoView now work with the .flv link.
Solution 1:
I got it to work using this code. You can play it local from your device or stream it from online. You have to drag an instance of the FLV COMPONENT in your movie and then just delete it from the stage to it remains in your library.
varmyVideo:FLVPlayback = newFLVPlayback();
myVideo.source = "content/video/BeauIntro.flv"; // CHANGE THIS TO YOUR FLV
myVideo.autoPlay = true;
// I am choosing to load the flv into an empty movie but you don't have to. varmy_mc:MovieClip = newMovieClip();
addChild(my_mc);
/// These are important because it can mess up position with out it.
myVideo.align = StageAlign.TOP_LEFT;
myVideo.scaleMode = VideoScaleMode.EXACT_FIT;
// Setting the video to the screen size of device
myVideo.width = stage.stageWidth;
myVideo.height = stage.stageHeight;
// Adding my FLV into my empty movie.
my_mc.addChild(myVideo);
//Setting the empty Movie Clip for the video to the screen size of device
my_mc.width = stage.stageHeight;
my_mc.height = stage.stageHeight;
/// This will run when the video stops
myVideo.addEventListener(fl.video.VideoEvent.COMPLETE, VideoStopped);
functionVideoStopped(e:Event):void
{
myVideo.stop();
myVideo.visible = false; /// I wanted it to not be seen after playing.trace("stopped");
myVideo.removeEventListener(fl.video.VideoEvent.COMPLETE, VideoStopped);
}
Solution 2:
try this: String url=your url here; Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse(url), "flv-application/octet-stream"); startActivity(intent);
Post a Comment for "Playing Flv Android"