3
我正在研究一個使用videoView在應用程序內部顯示.3GP視頻文件的小型項目。我的代碼在模擬器中工作正常,但是在物理設備(Samsung Nexus S)上,它只能通過WiFi工作,並在3G上超時。下面是我使用下面通過3G連接的Android videoView
<?xml version="1.0" encoding="utf-8"?>
<VideoView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/videoView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
public class VideoViewActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.videoplayer);
Bundle info = getIntent().getExtras();
String path = info.getString("link");
VideoView videoView = (VideoView) findViewById(R.id.videoView);
MediaController mediaController = new MediaController(this);
mediaController.setMediaPlayer(videoView);
videoView.setVideoPath(path);
videoView.setMediaController(mediaController);
videoView.requestFocus();
videoView.start();
mediaController.show();
XML文件中的代碼下面是用於WiFi和3G的logcat的
在3G(不工作)
D/MediaPlayer(6984): Couldn't open file on client side, trying server side
I/AwesomePlayer( 81): setDataSource_l('http://url.com/ski/famous.
3gp')
V/ChromiumHTTPDataSource( 81): connect on behalf of uid 10111
I/ChromiumHTTPDataSource( 81): connect to http://url.com/ski/famo
us.3gp @0
I/ActivityManager( 150): Displayed com.madarasan.SkiDroid/.VideoViewActivity: +
82ms
I/ChromiumHTTPDataSourceSupport( 81): OnReadCompleted, read failed, status 4
E/NuCachedSource2( 81): source returned error -1004, 10 retries left
D/ConnectivityService( 150): handleInetConditionHoldEnd: net=0, condition=100,
published condition=0
Over WiFi(works)
D/MediaPlayer(6984): Couldn't open file on client side, trying server side
I/AwesomePlayer( 81): setDataSource_l('http://url.com/ski/famous.
3gp')
V/ChromiumHTTPDataSource( 81): connect on behalf of uid 10111
I/ChromiumHTTPDataSource( 81): connect to http://url.com/ski/famo
us.3gp @0
I/ActivityManager( 150): Displayed com.madarasan.SkiDroid/.VideoViewActivity: +
128ms
I/OMXCodec( 81): [OMX.SEC.MPEG4.Decoder] video dimensions are 320 x 240
是否有什麼理由videoView不會在3G上工作?我用錯了嗎?是否有更好/更簡單的方式在Android中顯示視頻?我不介意使用其他文件類型3GP只是一個例子。
任何幫助將不勝感激。謝謝。