Acquire wake lock when playing media

This commit is contained in:
daniel oeh 2014-08-05 16:43:33 +02:00
parent 5ae7371b2a
commit df92bd98ab
2 changed files with 5 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.media.AudioManager; import android.media.AudioManager;
import android.media.RemoteControlClient; import android.media.RemoteControlClient;
import android.os.PowerManager;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.util.Log; import android.util.Log;
import android.util.Pair; import android.util.Pair;
@ -684,6 +685,7 @@ public class PlaybackServiceMediaPlayer {
mediaPlayer = new AudioPlayer(context); mediaPlayer = new AudioPlayer(context);
} }
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setWakeMode(context, PowerManager.PARTIAL_WAKE_LOCK);
return setMediaPlayerListeners(mediaPlayer); return setMediaPlayerListeners(mediaPlayer);
} }

View File

@ -1,5 +1,6 @@
package de.danoeh.antennapod.util.playback; package de.danoeh.antennapod.util.playback;
import android.content.Context;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
import java.io.IOException; import java.io.IOException;
@ -63,4 +64,6 @@ public interface IPlayer {
void stop(); void stop();
public void setVideoScalingMode(int mode); public void setVideoScalingMode(int mode);
public void setWakeMode(Context context, int mode);
} }