Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Today I had the same problem and found a very bad and hacky workaround for this nasty problem: I realized that one can set a background color / drawable onto the <code>VideoView</code> which blends over the video surface and makes it completely hidden. This only works though while the underlying video is still <em>playing</em>, not when it is stopped (neither when it ended normally nor when <code>stopPlayback()</code> was called), otherwise you'd again see a black flicker. The background must also not be set in the beginning, otherwise the video would be completely hidden right from the start.</p> <p>So the only logical step for me was to post a delayed event just before I start the video - and since I know the video length, I let this event happen just a few milliseconds before it ends normally. I took a screenshot of the last frame in VLC and then blended it like this:</p> <pre><code>private void startVideo() { introVideo.setBackgroundDrawable(null); introVideo.postDelayed(new Runnable() { public void run() { if (!introVideo.isPlaying()) return; introVideo.setBackgroundResource(R.drawable.video_still_image); // other stuff here, for example a custom transition to // another activity } }, 7500); // the video is roughly 8000ms long introVideo.start(); } </code></pre> <p>This however was not enough, because when the video actually ended, I still got a short black screen flicker, so I also had to set the still image as background of the container that contained the video (in my case it was the layout of the activity):</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/video_still_image"&gt; &lt;VideoView android:id="@+id/introVideo" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentRight="true" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_alignParentBottom="true" android:layout_marginTop="-10dip" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>This activity is rendered in fullscreen and the video is (mostly) scaled to the total screen size (screen 1024x600, video 960x640). I say <em>mostly</em>, because for some unknown reason the layout's background image blends through for about 10px on top. This was the last hack I had to apply to make it work - move the video container <code>-10dip</code> into the void on top.</p> <p>This now looks awesome on my Galaxy Tab, I don't dare to test it on the SGS2 phone, though...</p>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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