Port over fix from 4.x branch

This commit is contained in:
Nick Fujita 2020-08-17 16:28:36 +09:00
parent f3e6ce1058
commit 553fef02cc

View File

@ -9,6 +9,7 @@ import com.facebook.react.bridge.WritableArray;
import com.facebook.react.bridge.WritableMap; import com.facebook.react.bridge.WritableMap;
import com.facebook.react.uimanager.events.RCTEventEmitter; import com.facebook.react.uimanager.events.RCTEventEmitter;
import com.google.android.exoplayer2.metadata.Metadata; 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.Id3Frame;
import com.google.android.exoplayer2.metadata.id3.TextInformationFrame; import com.google.android.exoplayer2.metadata.id3.TextInformationFrame;
@ -248,25 +249,38 @@ class VideoEventEmitter {
WritableArray metadataArray = Arguments.createArray(); WritableArray metadataArray = Arguments.createArray();
for (int i = 0; i < metadata.length(); i++) { 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) { if (frame instanceof TextInformationFrame) {
TextInformationFrame txxxFrame = (TextInformationFrame) frame; TextInformationFrame txxxFrame = (TextInformationFrame) frame;
value = txxxFrame.value; value = txxxFrame.value;
}
String identifier = frame.id;
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);
} }
String identifier = frame.id;
WritableMap map = Arguments.createMap();
map.putString("identifier", identifier);
map.putString("value", value);
metadataArray.pushMap(map);
} }
WritableMap event = Arguments.createMap(); WritableMap event = Arguments.createMap();