Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port over ID3 fix from 4.x branch #2116

Merged
merged 1 commit into from
Aug 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.uimanager.events.RCTEventEmitter;
import com.google.android.exoplayer2.metadata.Metadata;
import com.google.android.exoplayer2.metadata.emsg.EventMessage;
import com.google.android.exoplayer2.metadata.id3.Id3Frame;
import com.google.android.exoplayer2.metadata.id3.TextInformationFrame;

Expand Down Expand Up @@ -248,25 +249,38 @@ void timedMetadata(Metadata metadata) {
WritableArray metadataArray = Arguments.createArray();

for (int i = 0; i < metadata.length(); i++) {

Metadata.Entry entry = metadata.get(i);

if (entry instanceof Id3Frame) {

Id3Frame frame = (Id3Frame) metadata.get(i);
Id3Frame frame = (Id3Frame) entry;

String value = "";
String value = "";

if (frame instanceof TextInformationFrame) {
TextInformationFrame txxxFrame = (TextInformationFrame) frame;
value = txxxFrame.value;
}

String identifier = frame.id;
if (frame instanceof TextInformationFrame) {
TextInformationFrame txxxFrame = (TextInformationFrame) frame;
value = txxxFrame.value;
}

WritableMap map = Arguments.createMap();
map.putString("identifier", identifier);
map.putString("value", value);
String identifier = frame.id;

metadataArray.pushMap(map);
WritableMap map = Arguments.createMap();
map.putString("identifier", identifier);
map.putString("value", value);

metadataArray.pushMap(map);

} else if (entry instanceof EventMessage) {

EventMessage eventMessage = (EventMessage) entry;

WritableMap map = Arguments.createMap();
map.putString("identifier", eventMessage.schemeIdUri);
map.putString("value", eventMessage.value);
metadataArray.pushMap(map);

}
}

WritableMap event = Arguments.createMap();
Expand Down