Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid media player not working
    text
    copied!<p>I'm trying to develop an app that has many videos embedded in it, and I'd like to call Android's Media Player, with the video on VideoView object. However, i get these strange errors:</p> <ul> <li>I/MediaPlayer( 2874): Info (1,26)</li> <li>E/MediaPlayer( 2874): Error (-4,-4)</li> <li>D/VideoView( 2874): Error: -4,-4</li> </ul> <p>when i try to play a mp4 video, or another 3gp video that is not recorded from my phone. My code is something like:</p> <pre><code>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); // Load and start the movie video.setVideoPath("android.resource://com.example.child.protector/raw/output"); ctlr=new MediaController(this); ctlr.setMediaPlayer(video); video.setMediaController(ctlr); video.start(); //video.requestFocus();//this line is new } catch (Exception e) { Log.e("---------- this is my app --------", "error: " + e.getMessage(), e); } } } </code></pre> <p>and my layout is something like:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;VideoView android:id="@+id/test2" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center" /&gt; &lt;/FrameLayout&gt; </code></pre> <p>Is there something wrong with my code?</p> <p>and i know that my file is there and all. I've run this code with a sample 3GP video and it worked just fine (but i recorded the video from my phone and copied it to my computer and then re-packaged in to my app, 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 a MP4 to 3GP using MobileMediaConverter, it plays on my laptop but not in this app. Also note that if i open the video as a file (in other words, invoking the default video player on my Samsung Galaxy S phone) it works just fine (meaning my phone has the capabilities). So i'm wondering:</p> <ul> <li>is this something wrong with the code?</li> <li>is this more of a converting mp4 to 3gp error? </li> </ul> <p>Any help would be greatly appreciated. Thanks!!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload