projects
/
pub
/
Android
/
ownCloud.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Stop audio playback in background when a video preview is started
[pub/Android/ownCloud.git]
/
src
/
com
/
owncloud
/
android
/
media
/
MediaService.java
diff --git
a/src/com/owncloud/android/media/MediaService.java
b/src/com/owncloud/android/media/MediaService.java
index
30558cd
..
e636516
100644
(file)
--- a/
src/com/owncloud/android/media/MediaService.java
+++ b/
src/com/owncloud/android/media/MediaService.java
@@
-62,7
+62,8
@@
public class MediaService extends Service implements OnCompletionListener, OnPre
private static final String MY_PACKAGE = MediaService.class.getPackage() != null ? MediaService.class.getPackage().getName() : "com.owncloud.android.media";
/// Intent actions that we are prepared to handle
private static final String MY_PACKAGE = MediaService.class.getPackage() != null ? MediaService.class.getPackage().getName() : "com.owncloud.android.media";
/// Intent actions that we are prepared to handle
- public static final String ACTION_PLAY_FILE = MY_PACKAGE + ".android.media.action.PLAY_FILE";
+ public static final String ACTION_PLAY_FILE = MY_PACKAGE + ".action.PLAY_FILE";
+ public static final String ACTION_STOP_ALL = MY_PACKAGE + ".action.STOP_ALL";
/// Keys to add extras to the action
public static final String EXTRA_FILE = MY_PACKAGE + ".extra.FILE";
/// Keys to add extras to the action
public static final String EXTRA_FILE = MY_PACKAGE + ".extra.FILE";
@@
-72,7
+73,10
@@
public class MediaService extends Service implements OnCompletionListener, OnPre
public static final int OC_MEDIA_ERROR = 0;
/** Time To keep the control panel visible when the user does not use it */
public static final int OC_MEDIA_ERROR = 0;
/** Time To keep the control panel visible when the user does not use it */
- public static final int MEDIA_CONTROL_LIFE = 5000;
+ public static final int MEDIA_CONTROL_SHORT_LIFE = 5000;
+
+ /** Time To keep the control panel visible when the user does not use it */
+ public static final int MEDIA_CONTROL_PERMANENT = 0;
/** Volume to set when audio focus is lost and ducking is allowed */
private static final float DUCK_VOLUME = 0.1f;
/** Volume to set when audio focus is lost and ducking is allowed */
private static final float DUCK_VOLUME = 0.1f;
@@
-228,6
+232,9
@@
public class MediaService extends Service implements OnCompletionListener, OnPre
String action = intent.getAction();
if (action.equals(ACTION_PLAY_FILE)) {
processPlayFileRequest(intent);
String action = intent.getAction();
if (action.equals(ACTION_PLAY_FILE)) {
processPlayFileRequest(intent);
+
+ } else if (action.equals(ACTION_STOP_ALL)) {
+ processStopRequest(true);
}
return START_NOT_STICKY; // don't want it to restart in case it's killed.
}
return START_NOT_STICKY; // don't want it to restart in case it's killed.
@@
-496,7
+503,7
@@
public class MediaService extends Service implements OnCompletionListener, OnPre
}
configAndStartMediaPlayer();
if (mMediaController != null) {
}
configAndStartMediaPlayer();
if (mMediaController != null) {
- mMediaController.show(MEDIA_CONTROL_
LIFE
);
+ mMediaController.show(MEDIA_CONTROL_
PERMANENT
);
}
}
}
}