这是一种魔法...... VideoView,并在Android 3.1与4.1的视频显示 [英] It's a kind of magic... VideoView and displaying videos on Android 3.1 vs. 4.1
问题描述
喜的Android程序员,
Hi android programmers,
我已经很久挣扎了一整天上似乎有些奇怪,并没有解决的问题。
我追求的是一些指导和一些previous经验。
出于测试目的,我有一个摩托罗拉Xoom Galaxy Nexus的标签 的Galaxy Nexus手机和的Galaxy Tab 10.1
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.
主要检测应用发达/在的Galaxy Tab 10.1 。
应用程序是很简单的。 pressing一个按钮 - >开始视频
The main testing application is developed for/in the Galaxy Tab 10.1. The application is very simple. Pressing a button -> starting a video.
应用程序运行在的糖豆的设备的罚款。
但在 3.1 设备我虽然没有视频出现只能听到声音。
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.
要解决我创造了很多不同的codeCS /分辨率网格中的问题,但这似乎没有影响到播放(仍然只有声音没有画面)。
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.
有没有人曾与Xoom的或/和Galaxy Tab的10.1以前的经验?
Has anybody had prior experience with the Xoom or/and the Galaxy Tab 10.1?
以防万一,有些人可能会认为有与我的code这里有一个问题是:
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();
}
}
编辑:
清单文件
<?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:
添加以下行VideoView后设置:
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
我试图改变VideoView和根视图的阿尔法,但仍是结果是一样的。
I tried changing the Alpha of the VideoView and of the root View, but still the result is the same.
PS:几乎所有的文件(兼容的)可以嵌入Android的视频播放器应用程序打开。但我需要发挥他们的应用程序中...
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...
推荐答案
要所有可能在这里结束了百姓。
可能是这一点的最好办法是在这里请点击此链接:
To all the people that might end up here. Probably the best solution to this would be to follow this link here:
这篇关于这是一种魔法...... VideoView,并在Android 3.1与4.1的视频显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!