Refactoring

This commit is contained in:
Ryan Heise 2020-04-21 23:38:40 +10:00
parent 24d97848ee
commit 32d7939761
1 changed files with 8 additions and 5 deletions

View File

@ -300,7 +300,14 @@ public class AudioPlayer implements MethodCallHandler, Player.EventListener, Met
event.add(updatePosition = getCurrentPosition());
event.add(updateTime = System.currentTimeMillis());
event.add(Math.max(updatePosition, bufferedPosition));
event.add(collectIcyMetadata());
if (eventSink != null) {
eventSink.success(event);
}
}
private ArrayList<Object> collectIcyMetadata() {
final ArrayList<Object> icyData = new ArrayList<>();
final ArrayList<String> info;
final ArrayList<Object> headers;
@ -324,11 +331,7 @@ public class AudioPlayer implements MethodCallHandler, Player.EventListener, Met
}
icyData.add(info);
icyData.add(headers);
event.add(icyData);
if (eventSink != null) {
eventSink.success(event);
}
return icyData;
}
private long getCurrentPosition() {