HLSストリーム用のm3u8ファイルを提供するプロバイダーがあります(元々はiOSアプリでの使用を目的としています)。
Android 3.0+はhttpライブストリーミング(http://developer.android.com/guide/appendix/media-formats.html)をサポートしています。実際、Android3.0+の標準のVideoViewを使用してこれらのm3u8ファイルを再生できます。
編集:Androidはこれを「リアルタイム」のビデオフィードとして扱い、ビデオの長さを検索または計算する機能を無効にしているようです。(ここで-iOSとして、問題なくストリーム内を検索できます)
android 3.0+にこれらのファイル内をシークさせる方法はありますか?
他の人がテストするためのサンプルアクティビティは次のとおりです。
import android.app.Activity;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;
public class SandboxActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
VideoView vw = (VideoView) findViewById(R.id.videoView);
vw.setVideoPath("http://devimages.apple.com/iphone/samples/bipbop/gear4/prog_index.m3u8");
vw.setMediaController(new MediaController(this));
vw.requestFocus();
vw.start();
}
}
およびサンプルレイアウト:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center" android:id="@+id/root">
<VideoView
android:id="@+id/videoView"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
</RelativeLayout>
これは、AppleのサンプルHLSリンクを使用しています。