Note that there are some explanatory texts on larger screens.

plurals
  1. POOnVideoSizeChanged never called
    primarykey
    data
    text
    <p>I'm working with a VideoView for showing a video stream. Because I need the MediaController to be attached to the view itself and I want to prevent the black screen flicker caused by the videoview. I've tested the below code on my Nexus 7, worked like a charm. But now I tested it on my SGS2, and for some reason OnVideoSizeChanged is never called. </p> <pre><code>@Override public void onPrepared(MediaPlayer mp) { // TODO Auto-generated method stub Log.i("ONPREP", "called"); mp.setOnVideoSizeChangedListener(new OnVideoSizeChangedListener() { @Override public void onVideoSizeChanged(MediaPlayer mp, int width, int height) { videoview.setMediaController(mc); mc.setAnchorView(videoview); videoview.setBackgroundColor(Color.TRANSPARENT); Log.i("ONSIZECHANGE", "called"); } }); } </code></pre> <p>The video is playing like it should, I tested this by removing the OnVideoSizeChangedListener and just putting the code in the onPrepared method, but this is bringing back the screen flicker issue and leaves the mediacontroller unattached. This behaviour is also shown by the Log info in LogCat, ONPREP tag shows but never the ONSIZECHANGE. On my N7 both show, obviously cause the background color is changed.</p> <p>This is the code that sets and starts the video:</p> <pre><code>videoview.setOnPreparedListener(MainActivity.this); mc = new MediaController(MainActivity.this); mc.setMediaPlayer(videoview); videoview.setVideoURI(videourI); videoview.start(); </code></pre> <p>So why is it called on one device and not on another?</p> <p>Edit: Tested it on my Note 2, same issue as on the SGS2.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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