Use null seek parameter on method channel

This commit is contained in:
Ryan Heise 2020-06-09 01:49:17 +10:00
parent c0f7feeee8
commit 841bd10822
3 changed files with 9 additions and 11 deletions

View file

@ -267,14 +267,8 @@ public class AudioPlayer implements MethodCallHandler, Player.EventListener, Met
result.success(null);
break;
case "seek":
Object position = args.get(0);
long position2;
if (position instanceof Integer) {
position2 = (Integer) position;
} else {
position2 = (Long) position;
}
seek(position2 == -2 ? C.TIME_UNSET : position2, result);
Long position = getLong(args.get(0));
seek(position == null ? C.TIME_UNSET : position, result);
break;
case "dispose":
dispose();
@ -533,6 +527,10 @@ public class AudioPlayer implements MethodCallHandler, Player.EventListener, Met
sendError("abort", "Connection aborted");
}
public static Long getLong(Object o) {
return (o == null || o instanceof Long) ? (Long)o : new Long(((Integer)o).intValue());
}
enum PlaybackState {
none,
stopped,