Commit 49174a6f authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Fix potential crash on AudioFocus loss

parent 56cde161
...@@ -810,8 +810,12 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer { ...@@ -810,8 +810,12 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
mAudioManager.setParameters("bgm_state=true"); mAudioManager.setParameters("bgm_state=true");
} }
else { else {
result = mAudioManager.abandonAudioFocus(mAudioFocusListener); if (mAudioManager != null) {
mAudioManager.setParameters("bgm_state=false"); result = mAudioManager.abandonAudioFocus(mAudioFocusListener);
mAudioManager.setParameters("bgm_state=false");
}
else
result = AudioManager.AUDIOFOCUS_REQUEST_FAILED;
} }
return result; return result;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment