MediaPlayer video not showing

All your problems with Audio, Video and Images.

MediaPlayer video not showing

Postby davidemo89 » Tue Nov 20, 2012 11:18 pm

I have this big problem with playing video on my app.
I have this game and wanted to show some videos somewhere but, in the best case I can hear the sound but not see the video.

this is the holder

Code: Select all
     public void surfaceCreated(SurfaceHolder holder) {
          level.playerholder = holder;            
          gameLoopThread.setRunning(true);
          renderLoopThread.setRunning(true);
           gameLoopThread.start();
        renderLoopThread.start();            
     }


this is the creation of the mediaplayer and should show the video

Code: Select all
    while(!playerholder.isCreating());         
    MediaPlayer mediaPlayer = new MediaPlayer();
    mediaPlayer.setDisplay(playerholder);
         
         
    switch(startVideo){
   case 1:
   try {   
    mediaPlayer.setDataSource(context,Uri.parse("android.resource://com.getfun.treevolve/raw/getfunvideo"));
               mediaPlayer.prepare();
            } catch (IllegalArgumentException e1) {
               // TODO Auto-generated catch block
               e1.printStackTrace();
            } catch (SecurityException e1) {
               // TODO Auto-generated catch block
               e1.printStackTrace();
            } catch (IllegalStateException e1) {
               // TODO Auto-generated catch block
               e1.printStackTrace();
            } catch (IOException e1) {
               // TODO Auto-generated catch block
               e1.printStackTrace();
            }
            break;
         }
         
         
         
         
         Log.d("player", "Sec: " + Integer.toString(mediaPlayer.getDuration()));
               
         
         
         Log.d("player", "Video width: " + Integer.toString(mediaPlayer.getVideoWidth()));
         mediaPlayer.start();


With this settings my log shows only 0. Like the video is wrong.
If in the second line I delete the holder

Code: Select all
mediaPlayer.setDisplay(playerholder);


is working, all the info in the log are showing correctly but, I hear the audio but don't see anything.

Thank you for the help, I really need this. =)
davidemo89
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Nov 20, 2012 11:13 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: Google [Bot] and 16 guests