Fixed concatenating audio source methods (#142)

* Fixed concatenating audio source methods

* Cast media source key to String
This commit is contained in:
Sergio Tikhonov 2020-08-11 04:17:02 +03:00 committed by GitHub
parent 375505829e
commit b18e2bd530
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 10 deletions

View File

@ -319,34 +319,34 @@ public class AudioPlayer implements MethodCallHandler, Player.EventListener, Met
break;
case "concatenating.add":
concatenating(args.get(0))
.addMediaSource(getAudioSource(args.get(1)), null, () -> result.success(null));
.addMediaSource(getAudioSource(args.get(1)), handler, () -> result.success(null));
break;
case "concatenating.insert":
concatenating(args.get(0))
.addMediaSource((Integer)args.get(1), getAudioSource(args.get(2)), null, () -> result.success(null));
.addMediaSource((Integer)args.get(1), getAudioSource(args.get(2)), handler, () -> result.success(null));
break;
case "concatenating.addAll":
concatenating(args.get(0))
.addMediaSources(getAudioSources(args.get(1)), null, () -> result.success(null));
.addMediaSources(getAudioSources(args.get(1)), handler, () -> result.success(null));
break;
case "concatenating.insertAll":
concatenating(args.get(0))
.addMediaSources((Integer)args.get(1), getAudioSources(args.get(2)), null, () -> result.success(null));
.addMediaSources((Integer)args.get(1), getAudioSources(args.get(2)), handler, () -> result.success(null));
break;
case "concatenating.removeAt":
concatenating(args.get(0))
.removeMediaSource((Integer)args.get(1), null, () -> result.success(null));
.removeMediaSource((Integer)args.get(1), handler, () -> result.success(null));
break;
case "concatenating.removeRange":
concatenating(args.get(0))
.removeMediaSourceRange((Integer)args.get(1), (Integer)args.get(2), null, () -> result.success(null));
.removeMediaSourceRange((Integer)args.get(1), (Integer)args.get(2), handler, () -> result.success(null));
break;
case "concatenating.move":
concatenating(args.get(0))
.moveMediaSource((Integer)args.get(1), (Integer)args.get(2), null, () -> result.success(null));
.moveMediaSource((Integer)args.get(1), (Integer)args.get(2), handler, () -> result.success(null));
break;
case "concatenating.clear":
concatenating(args.get(0)).clear(null, () -> result.success(null));
concatenating(args.get(0)).clear(handler, () -> result.success(null));
break;
default:
result.notImplemented();
@ -423,7 +423,7 @@ public class AudioPlayer implements MethodCallHandler, Player.EventListener, Met
}
private ConcatenatingMediaSource concatenating(final Object index) {
return (ConcatenatingMediaSource)mediaSources.get((Integer)index);
return (ConcatenatingMediaSource)mediaSources.get((String)index);
}
private MediaSource getAudioSource(final Object json) {