实时视频流至Android [英] stream live video to Android
问题描述
我怎么能传输实时视频到Android(2.1及以上),我有两个环节: M3U8
和 F4M
(据我所知,不支持F4M)。
How can I stream live video to Android (2.1 and higher), I have two links: m3u8
and f4m
(As I know, f4m is not supported).
从我所看到的计算器,有一种方法来流M3U8与vitamio(但链接不工作)。
From what I saw on stackoverflow, there is a way to stream m3u8 with vitamio (but the link is not working ).
有没有流M3U8视频任何其他方式? 也许有,我可以使用其他格式的?
Is there any other way to stream m3u8 video ? Maybe there is other format that I can use ?
感谢。
推荐答案
由于没有人回答我的问题,我会做我自己。
Because no one answered my question, I will do it myself.
如果您要执行HLT(HTTP实时流)在Android 2.1及更高版本,你可以使用vitamio库。
If you want to perform HLT (HTTP Live Stream) on Android 2.1 and higher you may use the vitamio library.
网址为:。( http://www.vitamio.org/ )
下面是code例如: 主要布局:
Here is code example: The main layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingLeft="2px" android:paddingRight="2px"
android:paddingTop="2px" android:paddingBottom="2px"
android:layout_width="fill_parent" android:orientation="vertical">
<io.vov.vitamio.widget.VideoView
android:layout_height="fill_parent"
android:layout_width="fill_parent" android:id="@+id/VideoView">
</io.vov.vitamio.widget.VideoView>
</LinearLayout>
类:
import io.vov.vitamio.widget.MediaController;
import io.vov.vitamio.widget.VideoView;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
public class LiveStrimingTestActivity extends Activity{
VideoView videoView;
private void test_2(){
String httpLiveUrl = "http://aj.lsops.net/live/aljazeer_en_high.sdp/playlist.m3u8";
videoView = (VideoView) findViewById(R.id.VideoView);
videoView.setVideoURI(Uri.parse(httpLiveUrl));
MediaController mediaController = new MediaController(this);
videoView.setMediaController(mediaController);
videoView.requestFocus();
videoView.start();
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
test_2();
}
}
这篇关于实时视频流至Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!