[Android] Return length value of 0 when no media

Geoffrey Métais git at videolan.org
Tue Jan 16 17:45:59 CET 2018


vlc-android | branch: chromecast | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jan 16 15:08:53 2018 +0100| [2b13ca0925006c0c47592752432d9f3bc5747b2a] | committer: Geoffrey Métais

Return length value of 0 when no media

> https://code.videolan.org/videolan/vlc-android/commit/2b13ca0925006c0c47592752432d9f3bc5747b2a
---

 vlc-android/src/org/videolan/vlc/PlaybackService.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index d5697163e..d18ff28c7 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -1898,7 +1898,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
 
     @MainThread
     public long getLength() {
-        return  mMediaPlayer.getLength();
+        return  hasMedia() ? mMediaPlayer.getLength() : 0;
     }
 
     /**



More information about the Android mailing list