I'm trying to play a video faster/slower via the following block of code.
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
socket.send(positionID + ":playState:ready:empty");
player = mp;
player.setPlaybackParams(new PlaybackParams().setSpeed(1.0f));
}
});
I'm passing '1' as the parameter at the moment just for testing, which is supposed to be normal playback speed. But I get the following error regardless of what number I pass.
01-04 18:49:17.308 24548-24548/com.spectiv.slave E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.spectiv.slave, PID: 24548
java.lang.SecurityException
at android.media.MediaPlayer.setPlaybackParams(Native Method)
at com.spectiv.slave.videoActivity$3.onPrepared(videoActivity.java:80)
at android.widget.VideoView$2.onPrepared(VideoView.java:432)
at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:2830)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
I'm working targeting API level 23 with a compiled SDK version of 24 and I'm running the application on an Odroid C2. Any help is greatly appreciated.
EDIT - This error doesn't happen on an emulator. I have no idea what's different about the Android running on this Odroid C2. They were both Marshmallow.
Just wanted to put this as an answer for anyone searching. The error only happens on this specific piece of hardware (Odroid C2). Running the code in an emulator works.