Androidバージョン2.1,2.2,2.3,2.3.6、および4.0のデバイスを試しました。 vitamioアプリケーションは、Android 4.0を搭載したデバイスHTC onexを除くすべてのデバイスで5〜6秒間URLをストリーミングできます。
単純なm3u8のURLを呼び出すためのコードは、以下のとおりです。 多くのありがとうyorkw。
活動:
package com.livestrean;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.MediaController;
import android.widget.Toast;
import android.widget.VideoView;
public class streamplayer extends Activity {
/** Called when the activity is first created. */
private String path = "An m3u8 Url";
private VideoView mVideoView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try
{
setContentView(R.layout.surface_view_1);
mVideoView = (VideoView) findViewById(R.id.surface_view);
mVideoView.setVideoURI(Uri.parse(path));
mVideoView.setMediaController(new MediaController(this));
mVideoView.requestFocus();
mVideoView.postInvalidateDelayed(100);
mVideoView.start();
}catch (Exception e) {
Toast.makeText(streamplayer.this,"Error Occured:- " + e.getMessage(),Toast.LENGTH_SHORT).show();
}
}
}
レイアウト:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<VideoView
android:id="@+id/surface_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"/>
</LinearLayout>
おかげ
HLSは、APIレベルは、あなたのアプリケーションを構築するために使うのですか何のAndroid 2.3.3(APIレベル10)、以降サポートされています? vitamioでもHLS用にAndroid 2.1以降が必要です。 – yorkw
こんにちは、もっと詳しく説明しますか?私もvitamioBundleを使いましたが、同じ問題がありました。構築されたデバイス:サムスンギャラクシータブ7 "、バージョン2.2.1開発ツール:ターゲットSDK:Android 4.3、Min SDK:8.ありがとう。 –