|
33 | 33 | import com.facebook.react.bridge.ReactApplicationContext;
|
34 | 34 | import com.facebook.react.bridge.ReadableArray;
|
35 | 35 | import com.facebook.react.bridge.ReadableMap;
|
| 36 | +import com.facebook.react.bridge.WritableArray; |
36 | 37 | import com.facebook.react.bridge.WritableMap;
|
37 | 38 | import com.facebook.react.common.MapBuilder;
|
38 | 39 | import com.facebook.react.uimanager.ThemedReactContext;
|
|
108 | 109 | import com.jwplayer.pub.api.fullscreen.delegates.DialogLayoutDelegate;
|
109 | 110 | import com.jwplayer.pub.api.fullscreen.delegates.SystemUiDelegate;
|
110 | 111 | import com.jwplayer.pub.api.license.LicenseUtil;
|
| 112 | +import com.jwplayer.pub.api.media.captions.Caption; |
111 | 113 | import com.jwplayer.pub.api.media.playlists.PlaylistItem;
|
112 | 114 | import com.jwplayer.ui.views.CueMarkerSeekbar;
|
113 | 115 |
|
@@ -1443,6 +1445,38 @@ public void onAudioTrackChanged(AudioTrackChangedEvent audioTrackChangedEvent) {
|
1443 | 1445 |
|
1444 | 1446 | }
|
1445 | 1447 |
|
| 1448 | + // Captions Events |
| 1449 | + |
| 1450 | + @Override |
| 1451 | + public void onCaptionsChanged(CaptionsChangedEvent captionsChangedEvent) { |
| 1452 | + WritableMap event = Arguments.createMap(); |
| 1453 | + event.putString("message", "onCaptionsChanged"); |
| 1454 | + event.putInt("index", captionsChangedEvent.getCurrentTrack()); |
| 1455 | + getReactContext().getJSModule(RCTEventEmitter.class).receiveEvent(getId(), "topCaptionsChanged", event); |
| 1456 | + } |
| 1457 | + |
| 1458 | + @Override |
| 1459 | + public void onCaptionsList(CaptionsListEvent captionsListEvent) { |
| 1460 | + WritableMap event = Arguments.createMap(); |
| 1461 | + List<Caption> captionTrackList = captionsListEvent.getCaptions(); |
| 1462 | + WritableArray captionTracks = Arguments.createArray(); |
| 1463 | + if (captionTrackList != null) { |
| 1464 | + for(int i = 0; i < captionTrackList.size(); i++) { |
| 1465 | + WritableMap captionTrack = Arguments.createMap(); |
| 1466 | + Caption track = captionTrackList.get(i); |
| 1467 | + captionTrack.putString("file", track.getFile()); |
| 1468 | + captionTrack.putString("label", track.getLabel()); |
| 1469 | + captionTrack.putBoolean("default", track.isDefault()); |
| 1470 | + captionTracks.pushMap(captionTrack); |
| 1471 | + } |
| 1472 | + } |
| 1473 | + event.putString("message", "onCaptionsList"); |
| 1474 | + event.putInt("index", captionsListEvent.getCurrentCaptionIndex()); |
| 1475 | + event.putArray("tracks", captionTracks); |
| 1476 | + getReactContext().getJSModule(RCTEventEmitter.class).receiveEvent(getId(), "topCaptionsList", event); |
| 1477 | + |
| 1478 | + } |
| 1479 | + |
1446 | 1480 | // Player Events
|
1447 | 1481 |
|
1448 | 1482 | @Override
|
@@ -1658,16 +1692,6 @@ public void onTime(TimeEvent timeEvent) {
|
1658 | 1692 | getReactContext().getJSModule(RCTEventEmitter.class).receiveEvent(getId(), "topTime", event);
|
1659 | 1693 | }
|
1660 | 1694 |
|
1661 |
| - @Override |
1662 |
| - public void onCaptionsChanged(CaptionsChangedEvent captionsChangedEvent) { |
1663 |
| - |
1664 |
| - } |
1665 |
| - |
1666 |
| - @Override |
1667 |
| - public void onCaptionsList(CaptionsListEvent captionsListEvent) { |
1668 |
| - |
1669 |
| - } |
1670 |
| - |
1671 | 1695 | @Override
|
1672 | 1696 | public void onMeta(MetaEvent metaEvent) {
|
1673 | 1697 |
|
|
0 commit comments