2

Hi android programmers,

I've been struggling all day long on a problem that seems strange and with no solution. What I seek is some guidance and some previous experiences. For testing purposes I have a Motorola Xoom, Galaxy Nexus Tab, Galaxy Nexus phone, and a Galaxy Tab 10.1.

The main testing application is developed for/in the Galaxy Tab 10.1. The application is very simple. Pressing a button -> starting a video.

The application runs fine on the Jelly Beans devices. But on the 3.1 devices I can only hear the audio while no video appears.

To troubleshoot the issue I created a grid with many different codecs/resolutions, but this seems not to affect the playback (still only audio and no video).

Needless to say, the application runs smoothly on the Jelly Beans phone and tablet.

Has anybody had prior experience with the Xoom or/and the Galaxy Tab 10.1?

Just in case some might think there's a problem with my code here is it:

VideoView v[];
@Override
public void onCreate(Bundle savedInstanceState) {
    // Enable some Menu options
    super.MENU_HELP = true;
    super.BACK_ACTIVATED =true;

    super.onCreate(savedInstanceState);

    setContentView(R.layout.video_view);
    // A mix of different codecs and resolutions
    String fileName[] = {
            "v1.mkv",
            "v2.m4v",
            "v3_mpg4.m4v",
            "v4.m4v",
            "v5_and_mid.m4v",
            "v6_ipad.m4v",
            "v7_ipod.m4v",
            "v8.m4v",
            "v9.mp4"};

    v = new VideoView[9];

    v[0] = (VideoView) findViewById(R.id.v1);
    v[1] = (VideoView) findViewById(R.id.v2);
    v[2] = (VideoView) findViewById(R.id.v3);
    v[3] = (VideoView) findViewById(R.id.v4);
    v[4] = (VideoView) findViewById(R.id.v5);
    v[5] = (VideoView) findViewById(R.id.v6);
    v[6] = (VideoView) findViewById(R.id.v7);
    v[7] = (VideoView) findViewById(R.id.v8);
    v[8] = (VideoView) findViewById(R.id.v9);

    String root = Environment.getExternalStorageDirectory().toString();

    for (int i=0; i<9; i++) {   
        v[i].setVideoPath(root + "/Videos/" + fileName[i]);
        v[i].start();
    }
}

EDIT: Manifest File

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="org.app"
        android:versionCode="1"
        android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="3"
    android:targetSdkVersion="12" />


    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.intent.action.CALL_PRIVILEGED" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.SET_DEBUG_APP" />

    <supports-screens
        android:anyDensity="true"
        android:largeScreens="true"
        android:normalScreens="true"
        android:resizeable="true"
        android:smallScreens="true" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".Main"
            android:label="@string/app_name"
            android:screenOrientation="landscape" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
            android:name=".MyVideoPlayer"
            android:label="@string/app_name"
            android:screenOrientation="landscape" />
    </application>

</manifest>

EDIT2:

Adding the following line after the VideoView is setup:

Log.i("MyVP", "" + v.isOpaque() + " " + v.isEnabled() + " " + v.isPlaying() + " " + v.isShown());

it shows false true false false

I tried changing the Alpha of the VideoView and of the root View, but still the result is the same.

PS: Almost all the files (the compatible ones) can be opened with the Video player application embedded in Android. But I need to play them inside the application...

4

2 回答 2

0

According to your manifest file, your sdk version are not compatible with your other devices. uses-sdk android:minSdkVersion="12" .

<uses-sdk
        android:minSdkVersion="3"
        android:targetSdkVersion="12" />

Edit your code according to it, good luck!

于 2012-07-26T20:51:37.633 回答
0

To all the people that might end up here. Probably the best solution to this would be to follow this link here:

WebView and HTML5 <video>

于 2012-07-31T16:13:51.790 回答