hallo everyone, I have to play a video in my android app but I have some 
problems. I hear the audio but I don't see any video.

The code is this:

This is where the surface is created and the game starts.

> [...]
> public void surfaceCreated(SurfaceHolder holder) {
> level.playerholder = holder; 
> gameLoopThread.setRunning(true);
> renderLoopThread.setRunning(true);
> gameLoopThread.start();
> renderLoopThread.start();
>
> }
> [...]





    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 code, nothing works. the log of "Sec:" and "Video width" show 
just "0".
If I delete in the second line the holder 
(mediaPlayer.setDisplay(playerholder);) the video is playing somewhere, I 
can hear the music, the log show me the correct information but I don't see 
anything.

Any solution on this? What I'm doing wrong?

Thank you everyone for the help, I really need this :-( 

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to