0

多くVideoViewのデバイスで動作しますが、他のデバイスでは動作しません。しばらくの間、私が表示され、ビデオを再生ProgressDialogできませんというポップアップが表示されます(イタリア語から翻訳されているため、異なる場合がありますが...わかります)。

たとえば、Samsung Galaxy S で動作します。

  • Android バージョン: 2.2.1
  • カーネル バージョン: 2.6.32.9

しかし、HTC Magic にはありません。

  • Android バージョン: 2.2
  • カーネル バージョン: 2.6.34.5

表示したいビデオは URL から取得され、MP4 ファイルです。

コードは次のとおりです。

public class VideoViewActivity extends BaseActivity {

    ProgressDialog progDialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Uri videoUri = Uri.parse(getIntent().getStringExtra("url"));
        setContentView(R.layout.activity_video_view);
        VideoView vv = (VideoView) findViewById(R.id.videoView);
        vv.setMediaController(new MediaController(this));
        vv.requestFocus();
        vv.setVideoURI(videoUri);
        vv.start();

        if (app.isEnglish()) {
            progDialog = ProgressDialog.show(this, getResources().getString(R.string.en_wait), getResources().getString(R.string.en_load), true);
        }
        else {
            progDialog = ProgressDialog.show(this, getResources().getString(R.string.it_wait), getResources().getString(R.string.it_load), true);
        }


        progDialog.setCancelable(true);
        vv.setOnPreparedListener(new OnPreparedListener() {
            public void onPrepared(MediaPlayer mp) {
                progDialog.dismiss();
            }
        });
    }
}

それがレイアウトです:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".VideoViewActivity" >

    <VideoView
        android:id="@+id/videoView"
        android:layout_centerInParent="true"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</RelativeLayout>

助言がありますか?

4

1 に答える 1

0

私もvideoViewを使用しているときに同じiisueを持っていました。インテントを使用して、デバイスにインストールされたメディア アプリケーションを使用して管理しました。彼らはメディアを管理するためのアプリケーションを実行しています。なぜ私たちは時間を無駄にしたいのですか...

PackageManager packageManager = getPackageManager();
                    Intent videoIntent = new Intent(Intent.ACTION_VIEW);
                    videoIntent.setDataAndType(Uri.parse(videoUrlLink),
                            "video/*");
                    List listOfSuppApps = packageManager
                            .queryIntentActivities(videoIntent,
                                    PackageManager.MATCH_DEFAULT_ONLY);
                    if (listOfSuppApps.size() <= 0) {
                        Toast.makeText(getApplicationContext(),
                                getResources().getString(R.string.No_supported_applications_Installed),
                                Toast.LENGTH_LONG).show();
                    } else {

                        Intent intnt = new Intent(Intent.ACTION_VIEW);
        intnt.setDataAndType(Uri.parse(urlLink), mediaType+"/*");
        context.startActivity(intnt);
                    }

上記は私のコードです

于 2013-05-24T13:12:47.197 に答える