I am trying to develop an application in which there are many videos embedded in it, and I would like to name Android Media Player with video on the VideoView object. However, I get these strange errors:
- I / MediaPlayer (2874): Information (1.26)
- E / MediaPlayer (2874): error (-4, -4)
- D / VideoView (2874): Error: -4, -4
when I try to play mp4 video or other 3gp video that is not being recorded from my phone. My code looks something like this:
import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.widget.MediaController; import android.widget.VideoView; public class PlayTest2 extends Activity{ private MediaController ctlr; public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.test2); try { VideoView video = (VideoView) findViewById(R.id.test2);
and my layout is something like:
<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <VideoView android:id="@+id/test2" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center" /> </FrameLayout>
Is there something wrong with my code?
and I know that my file is there and that's it. I ran this code with a sample 3GP video and it worked fine (but I recorded the video from my phone and copied it to my computer and then packed it back into my application under the / res / raw folder in Eclipse). However, the problem is that for some reason, my media player only plays certain 3GPP files. If I try to convert MP4 to 3GP using MobileMediaConverter, it plays on my laptop, but not in this application. Also note that if I open the video as a file (in other words, by calling the default player on my Samsung Galaxy S phone), it works fine (this means that my phone has features). Therefore, I am interested in:
- Is this something wrong with the code?
- Is it rather a mp4-3gp error conversion?
Any help would be greatly appreciated. Thank!!
android android-mediaplayer android-videoview
David T. May 28 '11 at 3:44 2011-05-28 03:44
source share