"Cannot play video"

All your problems with Audio, Video and Images.

"Cannot play video"

Postby Moppel » Mon Mar 15, 2010 2:29 pm

I wrote my own Videoplaying app (pretty simple) and I am having problems playing the video. It's not like I just hear the audio and no image is popping up. The only thing I get is the first picture of the video and then it gets stuck. The audio is playing properly though. After some seconds I get a message "Cannot play video. Sorry this video cannot be played".
I assume this has something to do with the encoding and/or the sdk version. I am using sdk 1.5 with a target emulator of 2.1. Data formats are mp4 and 3gp, nothing works. I've tried several mp4/3gp converter programs but without any result.

Does somebody have a clue what's going on?

ActivityCode:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. public class VideoAnzeige extends Activity {
  3.  
  4.        
  5.  
  6.         private static final String TAG = VideoAnzeige.class.getSimpleName();
  7.  
  8.        
  9.  
  10.         private VideoView vv;
  11.  
  12.        
  13.  
  14.         @Override
  15.  
  16.         public void onCreate(Bundle savedInstanceState){
  17.  
  18.                 Log.d(TAG, "VideoAnzeige wird erstellt...");
  19.  
  20.                
  21.  
  22.                 super.onCreate(savedInstanceState);
  23.  
  24.                 setContentView(R.layout.video_view);
  25.  
  26.                
  27.  
  28.                 Intent intent = getIntent();
  29.  
  30.                 String dataname = intent.getStringExtra("dateiname");
  31.  
  32.                 vv = (VideoView) findViewById(R.id.surface_view);
  33.  
  34.  
  35.  
  36.                 Log.d(TAG, "Beginne mit Video abspielen");
  37.  
  38.                 try{
  39.  
  40.                         vv.setVideoPath("/sdcard/" + dataname);
  41.  
  42.                         vv.start();
  43.  
  44.                 }
  45.  
  46.                 catch(Exception e){
  47.  
  48.                         Log.e(TAG, "Fehler beim Abspielen des Videos: " + e.toString());
  49.  
  50.                         if(vv != null){
  51.  
  52.                                 vv.stopPlayback();
  53.  
  54.                         }
  55.  
  56.                 }
  57.  
  58.         }
  59.  
  60. }
  61.  
  62.  
Parsed in 0.034 seconds, using GeSHi 1.0.8.4


The XML file of the VideoView I am using to display the video:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <?xml version="1.0" encoding="utf-8"?>
  3.  
  4. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  5.  
  6.              android:orientation="vertical"
  7.  
  8.              android:layout_width="fill_parent"
  9.  
  10.              android:layout_height="fill_parent"
  11.  
  12.        >
  13.  
  14.         <VideoView android:id="@+id/surface_view"
  15.  
  16.                   android:layout_width="fill_parent"
  17.  
  18.                   android:layout_height="fill_parent">
  19.  
  20.         </VideoView>
  21.  
  22. </LinearLayout>
  23.  
  24.  
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


And a LogCat excerpt of what happens during VideoPlayback:

03-15 13:15:32.331: WARN/PlayerDriver(31): Using generic video MIO
03-15 13:15:32.651: ERROR/SW_DEC(31): PV SW DECODER is used for H.263
03-15 13:15:32.912: DEBUG/AudioSink(31): bufferCount (4) is too small and increased to 12
03-15 13:15:33.562: WARN/MediaPlayer(3285): info/warning (1, 44)
03-15 13:15:33.571: INFO/MediaPlayer(3285): Info (1,44)
03-15 13:15:33.593: DEBUG/MediaPlayer(3285): getMetadata
03-15 13:15:35.352: WARN/AudioFlinger(31): write blocked for 70 msecs, 5 delayed writes, thread 0xb338
03-15 13:15:41.132: WARN/PlayerDriver(31): Video track fell behind
03-15 13:15:41.152: ERROR/MediaPlayer(3285): error (1, 48)
03-15 13:15:41.172: ERROR/MediaPlayer(3285): Error (1,48)
03-15 13:15:41.172: DEBUG/VideoView(3285): Error: 1,48
03-15 13:15:49.933: WARN/InputManagerService(58): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@43dba3f0
Moppel
Freshman
Freshman
 
Posts: 6
Joined: Fri Feb 19, 2010 3:12 pm

Top

Postby asolanki » Wed Mar 24, 2010 6:39 am

Hi!!

i have heard that emulator has problem playing videos sometime so try to run this application on device ..
may be on device it play well
asolanki
Senior Developer
Senior Developer
 
Posts: 151
Joined: Thu Jan 08, 2009 7:32 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 19 guests