[Android] Save video pause status with a flag

Edward Wang edward.c.wang at compdigitec.com
Tue Jan 6 05:13:07 CET 2015


On 2015-01-06 03:37, Jean-Baptiste Kempf <jb at videolan.org> wrote:
> On 05 Jan, Edward Wang wrote :
>> >+            // Paused flag
>> >+            boolean wasPaused = mSettings.getBoolean(PreferencesActivity.VIDEO_PAUSED, false);
>> >+            if(wasPaused) {
>> >+                Log.d(TAG, "Video was previously paused, resuming in paused mode");
>> >+                mHandler.postDelayed(new Runnable() {
>> >+                    @Override
>> >+                    public void run() {
>> >+                        mLibVLC.pause();
>> >+                    }}, 500);
>> >+            }
> Sorry, but this is overly ugly.
>
> What if the video takes more than 500ms to open? What if it takes less?

This is modelled after existing code in VideoPlayerActivity.java:680, 
with the case of pause due to lock screen.

I could fix both of them at once using a callback, if it is desired.

Regards,
   Edward Wang


More information about the Android mailing list