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