Bug fix for trying to set pitch when media is null.
This commit is contained in:
parent
47d5bf609d
commit
2db89cb807
|
@ -1524,21 +1524,21 @@ public class PlaybackService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canSetSpeed() {
|
public boolean canSetSpeed() {
|
||||||
if (media.getMediaType() == MediaType.AUDIO) {
|
if (media != null && media.getMediaType() == MediaType.AUDIO) {
|
||||||
return ((AudioPlayer) player).canSetSpeed();
|
return ((AudioPlayer) player).canSetSpeed();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canSetPitch() {
|
public boolean canSetPitch() {
|
||||||
if (media.getMediaType() == MediaType.AUDIO) {
|
if (media != null && media.getMediaType() == MediaType.AUDIO) {
|
||||||
return ((AudioPlayer) player).canSetPitch();
|
return ((AudioPlayer) player).canSetPitch();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSpeed(double speed) {
|
public void setSpeed(double speed) {
|
||||||
if (media.getMediaType() == MediaType.AUDIO) {
|
if (media != null && media.getMediaType() == MediaType.AUDIO) {
|
||||||
AudioPlayer audioPlayer = (AudioPlayer) player;
|
AudioPlayer audioPlayer = (AudioPlayer) player;
|
||||||
if (audioPlayer.canSetSpeed()) {
|
if (audioPlayer.canSetSpeed()) {
|
||||||
audioPlayer.setPlaybackSpeed((float) speed);
|
audioPlayer.setPlaybackSpeed((float) speed);
|
||||||
|
@ -1551,7 +1551,7 @@ public class PlaybackService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPitch(double pitch) {
|
public void setPitch(double pitch) {
|
||||||
if (media.getMediaType() == MediaType.AUDIO) {
|
if (media != null && media.getMediaType() == MediaType.AUDIO) {
|
||||||
AudioPlayer audioPlayer = (AudioPlayer) player;
|
AudioPlayer audioPlayer = (AudioPlayer) player;
|
||||||
if (audioPlayer.canSetPitch()) {
|
if (audioPlayer.canSetPitch()) {
|
||||||
audioPlayer.setPlaybackPitch((float) pitch);
|
audioPlayer.setPlaybackPitch((float) pitch);
|
||||||
|
|
Loading…
Reference in New Issue