玩flv android

时间:2012-05-02 15:43:30

标签: android

我们可以在不使用WebView的情况下在Android中播放flv流视频,这太慢了吗?我的意思是直接从网址播放.flv视频。有任何想法吗? VideoView现在可以使用.flv链接。

2 个答案:

答案 0 :(得分:1)

我使用此代码完成了它。您可以通过设备在本地播放或从在线播放。您必须在电影中拖动FLV COMPONENT的实例,然后将其从舞台中删除,它将保留在您的库中。

var myVideo:FLVPlayback = new FLVPlayback();
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. 
var my_mc:MovieClip = new MovieClip(); 
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);
function VideoStopped(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);

    }

答案 1 :(得分:0)

试试这个:     String url =你的网址在这里;     Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);     intent.setDataAndType(Uri.parse(url),“flv-application / octet-stream”);     startActivity(意向);