2017-01-11 12:51:45 +00:00
|
|
|
package com.brentvatne.exoplayer;
|
|
|
|
|
|
|
|
import android.content.Context;
|
2023-11-18 22:13:54 +09:00
|
|
|
import android.graphics.Color;
|
2017-01-11 12:51:45 +00:00
|
|
|
import android.net.Uri;
|
|
|
|
import android.text.TextUtils;
|
2023-10-10 09:47:56 +02:00
|
|
|
import android.util.Log;
|
2017-01-11 12:51:45 +00:00
|
|
|
|
2024-03-31 20:03:52 +02:00
|
|
|
import androidx.annotation.NonNull;
|
2023-11-18 22:13:54 +09:00
|
|
|
|
2024-05-06 22:04:40 +02:00
|
|
|
import com.brentvatne.common.api.BufferConfig;
|
2024-05-11 22:02:04 +02:00
|
|
|
import com.brentvatne.common.api.BufferingStrategy;
|
2024-05-20 14:15:18 +03:30
|
|
|
import com.brentvatne.common.api.ControlsConfig;
|
2024-06-10 22:42:18 +02:00
|
|
|
import com.brentvatne.common.api.DRMProps;
|
2023-12-07 08:47:40 +01:00
|
|
|
import com.brentvatne.common.api.ResizeMode;
|
2024-05-11 18:57:59 +02:00
|
|
|
import com.brentvatne.common.api.SideLoadedTextTrackList;
|
2024-05-30 08:53:49 +02:00
|
|
|
import com.brentvatne.common.api.Source;
|
2023-12-07 08:47:40 +01:00
|
|
|
import com.brentvatne.common.api.SubtitleStyle;
|
2024-06-27 11:58:06 +02:00
|
|
|
import com.brentvatne.common.api.ViewType;
|
2024-07-04 21:01:28 +09:00
|
|
|
import com.brentvatne.common.react.EventTypes;
|
2023-10-10 09:47:56 +02:00
|
|
|
import com.brentvatne.common.toolbox.DebugLog;
|
|
|
|
import com.brentvatne.common.toolbox.ReactBridgeUtils;
|
2024-06-25 08:55:32 +02:00
|
|
|
import com.brentvatne.react.ReactNativeVideoManager;
|
2018-06-11 21:25:58 -07:00
|
|
|
import com.facebook.react.bridge.ReadableArray;
|
2017-01-11 12:51:45 +00:00
|
|
|
import com.facebook.react.bridge.ReadableMap;
|
|
|
|
import com.facebook.react.uimanager.ThemedReactContext;
|
|
|
|
import com.facebook.react.uimanager.ViewGroupManager;
|
|
|
|
import com.facebook.react.uimanager.annotations.ReactProp;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import javax.annotation.Nullable;
|
|
|
|
|
|
|
|
public class ReactExoplayerViewManager extends ViewGroupManager<ReactExoplayerView> {
|
|
|
|
|
2024-05-11 19:03:44 +02:00
|
|
|
private static final String TAG = "ExoViewManager";
|
2017-01-11 12:51:45 +00:00
|
|
|
private static final String REACT_CLASS = "RCTVideo";
|
|
|
|
private static final String PROP_SRC = "src";
|
2019-12-10 11:40:49 +07:00
|
|
|
private static final String PROP_AD_TAG_URL = "adTagUrl";
|
2017-01-11 12:51:45 +00:00
|
|
|
private static final String PROP_RESIZE_MODE = "resizeMode";
|
|
|
|
private static final String PROP_REPEAT = "repeat";
|
2018-07-17 14:14:21 -07:00
|
|
|
private static final String PROP_SELECTED_AUDIO_TRACK = "selectedAudioTrack";
|
|
|
|
private static final String PROP_SELECTED_AUDIO_TRACK_TYPE = "type";
|
|
|
|
private static final String PROP_SELECTED_AUDIO_TRACK_VALUE = "value";
|
2018-06-02 02:24:13 -07:00
|
|
|
private static final String PROP_SELECTED_TEXT_TRACK = "selectedTextTrack";
|
|
|
|
private static final String PROP_SELECTED_TEXT_TRACK_TYPE = "type";
|
|
|
|
private static final String PROP_SELECTED_TEXT_TRACK_VALUE = "value";
|
2018-06-11 21:25:58 -07:00
|
|
|
private static final String PROP_TEXT_TRACKS = "textTracks";
|
2017-01-11 12:51:45 +00:00
|
|
|
private static final String PROP_PAUSED = "paused";
|
|
|
|
private static final String PROP_MUTED = "muted";
|
2023-04-02 14:02:56 -04:00
|
|
|
private static final String PROP_AUDIO_OUTPUT = "audioOutput";
|
2017-01-11 12:51:45 +00:00
|
|
|
private static final String PROP_VOLUME = "volume";
|
2018-08-02 09:20:08 +02:00
|
|
|
private static final String PROP_BUFFER_CONFIG = "bufferConfig";
|
2020-06-16 14:31:23 +02:00
|
|
|
private static final String PROP_PREVENTS_DISPLAY_SLEEP_DURING_VIDEO_PLAYBACK = "preventsDisplaySleepDuringVideoPlayback";
|
2017-03-31 18:15:39 +02:00
|
|
|
private static final String PROP_PROGRESS_UPDATE_INTERVAL = "progressUpdateInterval";
|
2018-08-25 21:53:11 +05:30
|
|
|
private static final String PROP_REPORT_BANDWIDTH = "reportBandwidth";
|
2017-01-11 12:51:45 +00:00
|
|
|
private static final String PROP_RATE = "rate";
|
2019-02-10 19:47:07 -08:00
|
|
|
private static final String PROP_MIN_LOAD_RETRY_COUNT = "minLoadRetryCount";
|
2018-11-26 14:50:31 -08:00
|
|
|
private static final String PROP_MAXIMUM_BIT_RATE = "maxBitRate";
|
2017-01-11 12:51:45 +00:00
|
|
|
private static final String PROP_PLAY_IN_BACKGROUND = "playInBackground";
|
2021-11-09 14:22:32 +02:00
|
|
|
private static final String PROP_CONTENT_START_TIME = "contentStartTime";
|
2017-01-11 12:51:45 +00:00
|
|
|
private static final String PROP_DISABLE_FOCUS = "disableFocus";
|
2024-05-11 22:02:04 +02:00
|
|
|
private static final String PROP_BUFFERING_STRATEGY = "bufferingStrategy";
|
2021-05-17 13:09:09 +03:00
|
|
|
private static final String PROP_DISABLE_DISCONNECT_ERROR = "disableDisconnectError";
|
2022-09-26 01:51:18 +01:00
|
|
|
private static final String PROP_FOCUSABLE = "focusable";
|
2018-05-18 13:30:01 -07:00
|
|
|
private static final String PROP_FULLSCREEN = "fullscreen";
|
2024-06-27 11:58:06 +02:00
|
|
|
private static final String PROP_VIEW_TYPE = "viewType";
|
2018-08-24 15:33:46 +05:30
|
|
|
private static final String PROP_SELECTED_VIDEO_TRACK = "selectedVideoTrack";
|
|
|
|
private static final String PROP_SELECTED_VIDEO_TRACK_TYPE = "type";
|
|
|
|
private static final String PROP_SELECTED_VIDEO_TRACK_VALUE = "value";
|
2018-11-28 14:56:58 +02:00
|
|
|
private static final String PROP_HIDE_SHUTTER_VIEW = "hideShutterView";
|
2019-01-04 14:58:32 +05:30
|
|
|
private static final String PROP_CONTROLS = "controls";
|
2022-07-05 23:58:30 +02:00
|
|
|
private static final String PROP_SUBTITLE_STYLE = "subtitleStyle";
|
2023-07-23 21:38:26 +05:30
|
|
|
private static final String PROP_SHUTTER_COLOR = "shutterColor";
|
2024-05-07 12:30:57 +02:00
|
|
|
private static final String PROP_SHOW_NOTIFICATION_CONTROLS = "showNotificationControls";
|
2023-10-10 09:47:56 +02:00
|
|
|
private static final String PROP_DEBUG = "debug";
|
2024-05-20 14:15:18 +03:30
|
|
|
private static final String PROP_CONTROLS_STYLES = "controlsStyles";
|
2022-07-05 23:58:30 +02:00
|
|
|
|
2024-03-31 20:03:52 +02:00
|
|
|
private final ReactExoplayerConfig config;
|
2019-09-16 16:29:31 -04:00
|
|
|
|
|
|
|
public ReactExoplayerViewManager(ReactExoplayerConfig config) {
|
|
|
|
this.config = config;
|
|
|
|
}
|
|
|
|
|
2024-03-31 20:03:52 +02:00
|
|
|
@NonNull
|
2017-01-11 12:51:45 +00:00
|
|
|
@Override
|
|
|
|
public String getName() {
|
|
|
|
return REACT_CLASS;
|
|
|
|
}
|
|
|
|
|
2024-03-31 20:03:52 +02:00
|
|
|
@NonNull
|
2017-01-11 12:51:45 +00:00
|
|
|
@Override
|
2024-03-31 20:03:52 +02:00
|
|
|
protected ReactExoplayerView createViewInstance(@NonNull ThemedReactContext themedReactContext) {
|
2024-06-25 08:55:32 +02:00
|
|
|
ReactNativeVideoManager.Companion.getInstance().registerView(this);
|
2019-09-16 16:29:31 -04:00
|
|
|
return new ReactExoplayerView(themedReactContext, config);
|
2017-01-11 12:51:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onDropViewInstance(ReactExoplayerView view) {
|
|
|
|
view.cleanUpResources();
|
2024-06-25 08:55:32 +02:00
|
|
|
ReactNativeVideoManager.Companion.getInstance().unregisterView(this);
|
2017-01-11 12:51:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public @Nullable Map<String, Object> getExportedCustomDirectEventTypeConstants() {
|
2024-07-04 21:01:28 +09:00
|
|
|
return EventTypes.Companion.toMap();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void addEventEmitters(@NonNull ThemedReactContext reactContext, @NonNull ReactExoplayerView view) {
|
|
|
|
super.addEventEmitters(reactContext, view);
|
|
|
|
view.eventEmitter.addEventEmitters(reactContext, view);
|
2017-01-11 12:51:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@ReactProp(name = PROP_SRC)
|
|
|
|
public void setSrc(final ReactExoplayerView videoView, @Nullable ReadableMap src) {
|
|
|
|
Context context = videoView.getContext().getApplicationContext();
|
2024-05-30 08:53:49 +02:00
|
|
|
Source source = Source.parse(src, context);
|
|
|
|
if (source.getUri() == null) {
|
2021-06-30 10:24:21 +09:00
|
|
|
videoView.clearSrc();
|
2017-01-11 12:51:45 +00:00
|
|
|
} else {
|
2024-05-30 08:53:49 +02:00
|
|
|
videoView.setSrc(source);
|
2017-01-11 12:51:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-10 11:40:49 +07:00
|
|
|
@ReactProp(name = PROP_AD_TAG_URL)
|
|
|
|
public void setAdTagUrl(final ReactExoplayerView videoView, final String uriString) {
|
|
|
|
if (TextUtils.isEmpty(uriString)) {
|
2023-12-08 13:30:23 +01:00
|
|
|
videoView.setAdTagUrl(null);
|
2019-12-10 11:40:49 +07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-11-30 12:39:43 +01:00
|
|
|
Uri adTagUrl = Uri.parse(uriString);
|
2019-12-10 11:40:49 +07:00
|
|
|
|
2022-11-30 12:39:43 +01:00
|
|
|
videoView.setAdTagUrl(adTagUrl);
|
2019-12-10 11:40:49 +07:00
|
|
|
}
|
|
|
|
|
2017-01-11 12:51:45 +00:00
|
|
|
@ReactProp(name = PROP_RESIZE_MODE)
|
2023-10-11 21:56:54 +02:00
|
|
|
public void setResizeMode(final ReactExoplayerView videoView, final String resizeMode) {
|
|
|
|
switch (resizeMode) {
|
|
|
|
case "none":
|
|
|
|
case "contain":
|
|
|
|
videoView.setResizeModeModifier(ResizeMode.RESIZE_MODE_FIT);
|
|
|
|
break;
|
|
|
|
case "cover":
|
|
|
|
videoView.setResizeModeModifier(ResizeMode.RESIZE_MODE_CENTER_CROP);
|
|
|
|
break;
|
|
|
|
case "stretch":
|
|
|
|
videoView.setResizeModeModifier(ResizeMode.RESIZE_MODE_FILL);
|
|
|
|
break;
|
|
|
|
default:
|
2024-05-11 19:03:44 +02:00
|
|
|
DebugLog.w(TAG, "Unsupported resize mode: " + resizeMode + " - falling back to fit");
|
2023-10-11 21:56:54 +02:00
|
|
|
videoView.setResizeModeModifier(ResizeMode.RESIZE_MODE_FIT);
|
|
|
|
break;
|
|
|
|
}
|
2017-01-11 12:51:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@ReactProp(name = PROP_REPEAT, defaultBoolean = false)
|
|
|
|
public void setRepeat(final ReactExoplayerView videoView, final boolean repeat) {
|
|
|
|
videoView.setRepeatModifier(repeat);
|
|
|
|
}
|
|
|
|
|
2020-06-16 14:31:23 +02:00
|
|
|
@ReactProp(name = PROP_PREVENTS_DISPLAY_SLEEP_DURING_VIDEO_PLAYBACK, defaultBoolean = false)
|
2023-08-22 23:30:01 -04:00
|
|
|
public void setPreventsDisplaySleepDuringVideoPlayback(final ReactExoplayerView videoView, final boolean preventsSleep) {
|
2020-06-16 14:31:23 +02:00
|
|
|
videoView.setPreventsDisplaySleepDuringVideoPlayback(preventsSleep);
|
|
|
|
}
|
|
|
|
|
2018-08-24 15:33:46 +05:30
|
|
|
@ReactProp(name = PROP_SELECTED_VIDEO_TRACK)
|
|
|
|
public void setSelectedVideoTrack(final ReactExoplayerView videoView,
|
2023-08-22 23:30:01 -04:00
|
|
|
@Nullable ReadableMap selectedVideoTrack) {
|
2018-08-24 15:33:46 +05:30
|
|
|
String typeString = null;
|
2024-03-22 07:58:09 +01:00
|
|
|
String value = null;
|
2018-08-24 15:33:46 +05:30
|
|
|
if (selectedVideoTrack != null) {
|
2023-10-10 09:47:56 +02:00
|
|
|
typeString = ReactBridgeUtils.safeGetString(selectedVideoTrack, PROP_SELECTED_VIDEO_TRACK_TYPE);
|
2024-03-22 07:58:09 +01:00
|
|
|
value = ReactBridgeUtils.safeGetString(selectedVideoTrack, PROP_SELECTED_VIDEO_TRACK_VALUE);
|
2018-08-24 15:33:46 +05:30
|
|
|
}
|
|
|
|
videoView.setSelectedVideoTrack(typeString, value);
|
|
|
|
}
|
|
|
|
|
2018-07-17 14:14:21 -07:00
|
|
|
@ReactProp(name = PROP_SELECTED_AUDIO_TRACK)
|
|
|
|
public void setSelectedAudioTrack(final ReactExoplayerView videoView,
|
2023-08-22 23:30:01 -04:00
|
|
|
@Nullable ReadableMap selectedAudioTrack) {
|
2018-07-17 14:14:21 -07:00
|
|
|
String typeString = null;
|
2024-03-22 07:58:09 +01:00
|
|
|
String value = null;
|
2018-07-17 14:14:21 -07:00
|
|
|
if (selectedAudioTrack != null) {
|
2023-10-10 09:47:56 +02:00
|
|
|
typeString = ReactBridgeUtils.safeGetString(selectedAudioTrack, PROP_SELECTED_AUDIO_TRACK_TYPE);
|
2024-03-22 07:58:09 +01:00
|
|
|
value = ReactBridgeUtils.safeGetString(selectedAudioTrack, PROP_SELECTED_AUDIO_TRACK_VALUE);
|
2018-07-17 14:14:21 -07:00
|
|
|
}
|
|
|
|
videoView.setSelectedAudioTrack(typeString, value);
|
|
|
|
}
|
|
|
|
|
2018-06-02 02:24:13 -07:00
|
|
|
@ReactProp(name = PROP_SELECTED_TEXT_TRACK)
|
|
|
|
public void setSelectedTextTrack(final ReactExoplayerView videoView,
|
2023-08-22 23:30:01 -04:00
|
|
|
@Nullable ReadableMap selectedTextTrack) {
|
2018-06-20 15:34:36 -07:00
|
|
|
String typeString = null;
|
2024-03-22 07:58:09 +01:00
|
|
|
String value = null;
|
2018-06-20 15:34:36 -07:00
|
|
|
if (selectedTextTrack != null) {
|
2023-10-10 09:47:56 +02:00
|
|
|
typeString = ReactBridgeUtils.safeGetString(selectedTextTrack, PROP_SELECTED_TEXT_TRACK_TYPE);
|
2024-03-22 07:58:09 +01:00
|
|
|
value = ReactBridgeUtils.safeGetString(selectedTextTrack, PROP_SELECTED_TEXT_TRACK_VALUE);
|
2018-06-20 15:34:36 -07:00
|
|
|
}
|
2018-06-02 02:24:13 -07:00
|
|
|
videoView.setSelectedTextTrack(typeString, value);
|
|
|
|
}
|
|
|
|
|
2018-06-11 21:25:58 -07:00
|
|
|
@ReactProp(name = PROP_TEXT_TRACKS)
|
2024-07-12 17:27:42 +09:00
|
|
|
public void setTextTracks(final ReactExoplayerView videoView,
|
2023-08-22 23:30:01 -04:00
|
|
|
@Nullable ReadableArray textTracks) {
|
2024-05-11 18:57:59 +02:00
|
|
|
SideLoadedTextTrackList sideLoadedTextTracks = SideLoadedTextTrackList.Companion.parse(textTracks);
|
|
|
|
videoView.setTextTracks(sideLoadedTextTracks);
|
2018-06-11 21:25:58 -07:00
|
|
|
}
|
|
|
|
|
2017-01-11 12:51:45 +00:00
|
|
|
@ReactProp(name = PROP_PAUSED, defaultBoolean = false)
|
|
|
|
public void setPaused(final ReactExoplayerView videoView, final boolean paused) {
|
|
|
|
videoView.setPausedModifier(paused);
|
|
|
|
}
|
|
|
|
|
|
|
|
@ReactProp(name = PROP_MUTED, defaultBoolean = false)
|
|
|
|
public void setMuted(final ReactExoplayerView videoView, final boolean muted) {
|
|
|
|
videoView.setMutedModifier(muted);
|
|
|
|
}
|
|
|
|
|
2023-04-02 14:02:56 -04:00
|
|
|
@ReactProp(name = PROP_AUDIO_OUTPUT)
|
|
|
|
public void setAudioOutput(final ReactExoplayerView videoView, final String audioOutput) {
|
2023-09-05 14:27:10 -04:00
|
|
|
videoView.setAudioOutput(AudioOutput.get(audioOutput));
|
2023-04-02 14:02:56 -04:00
|
|
|
}
|
|
|
|
|
2017-01-11 12:51:45 +00:00
|
|
|
@ReactProp(name = PROP_VOLUME, defaultFloat = 1.0f)
|
|
|
|
public void setVolume(final ReactExoplayerView videoView, final float volume) {
|
|
|
|
videoView.setVolumeModifier(volume);
|
|
|
|
}
|
|
|
|
|
2017-03-31 18:15:39 +02:00
|
|
|
@ReactProp(name = PROP_PROGRESS_UPDATE_INTERVAL, defaultFloat = 250.0f)
|
|
|
|
public void setProgressUpdateInterval(final ReactExoplayerView videoView, final float progressUpdateInterval) {
|
|
|
|
videoView.setProgressUpdateInterval(progressUpdateInterval);
|
|
|
|
}
|
|
|
|
|
2018-08-25 21:53:11 +05:30
|
|
|
@ReactProp(name = PROP_REPORT_BANDWIDTH, defaultBoolean = false)
|
|
|
|
public void setReportBandwidth(final ReactExoplayerView videoView, final boolean reportBandwidth) {
|
2018-11-01 21:41:57 +05:30
|
|
|
videoView.setReportBandwidth(reportBandwidth);
|
2018-08-25 21:53:11 +05:30
|
|
|
}
|
|
|
|
|
2017-01-11 12:51:45 +00:00
|
|
|
@ReactProp(name = PROP_RATE)
|
|
|
|
public void setRate(final ReactExoplayerView videoView, final float rate) {
|
|
|
|
videoView.setRateModifier(rate);
|
|
|
|
}
|
|
|
|
|
2018-10-29 09:53:52 -07:00
|
|
|
@ReactProp(name = PROP_MAXIMUM_BIT_RATE)
|
2024-07-12 17:27:42 +09:00
|
|
|
public void setMaxBitRate(final ReactExoplayerView videoView, final float maxBitRate) {
|
|
|
|
videoView.setMaxBitRateModifier((int)maxBitRate);
|
2018-10-29 09:53:52 -07:00
|
|
|
}
|
|
|
|
|
2019-02-10 19:47:07 -08:00
|
|
|
@ReactProp(name = PROP_MIN_LOAD_RETRY_COUNT)
|
2024-07-12 17:27:42 +09:00
|
|
|
public void setMinLoadRetryCount(final ReactExoplayerView videoView, final int minLoadRetryCount) {
|
2019-02-10 19:47:07 -08:00
|
|
|
videoView.setMinLoadRetryCountModifier(minLoadRetryCount);
|
2019-01-24 18:49:37 +05:30
|
|
|
}
|
|
|
|
|
2017-01-11 12:51:45 +00:00
|
|
|
@ReactProp(name = PROP_PLAY_IN_BACKGROUND, defaultBoolean = false)
|
|
|
|
public void setPlayInBackground(final ReactExoplayerView videoView, final boolean playInBackground) {
|
|
|
|
videoView.setPlayInBackground(playInBackground);
|
|
|
|
}
|
|
|
|
|
|
|
|
@ReactProp(name = PROP_DISABLE_FOCUS, defaultBoolean = false)
|
|
|
|
public void setDisableFocus(final ReactExoplayerView videoView, final boolean disableFocus) {
|
|
|
|
videoView.setDisableFocus(disableFocus);
|
|
|
|
}
|
|
|
|
|
2022-09-26 01:51:18 +01:00
|
|
|
@ReactProp(name = PROP_FOCUSABLE, defaultBoolean = true)
|
|
|
|
public void setFocusable(final ReactExoplayerView videoView, final boolean focusable) {
|
|
|
|
videoView.setFocusable(focusable);
|
|
|
|
}
|
|
|
|
|
2022-08-05 18:57:10 +02:00
|
|
|
@ReactProp(name = PROP_CONTENT_START_TIME, defaultInt = -1)
|
2021-11-09 14:22:32 +02:00
|
|
|
public void setContentStartTime(final ReactExoplayerView videoView, final int contentStartTime) {
|
|
|
|
videoView.setContentStartTime(contentStartTime);
|
|
|
|
}
|
|
|
|
|
2024-05-11 22:02:04 +02:00
|
|
|
@ReactProp(name = PROP_BUFFERING_STRATEGY)
|
|
|
|
public void setBufferingStrategy(final ReactExoplayerView videoView, final String bufferingStrategy) {
|
|
|
|
BufferingStrategy.BufferingStrategyEnum strategy = BufferingStrategy.Companion.parse(bufferingStrategy);
|
|
|
|
videoView.setBufferingStrategy(strategy);
|
2021-03-18 03:58:04 -07:00
|
|
|
}
|
|
|
|
|
2021-05-17 13:09:09 +03:00
|
|
|
@ReactProp(name = PROP_DISABLE_DISCONNECT_ERROR, defaultBoolean = false)
|
|
|
|
public void setDisableDisconnectError(final ReactExoplayerView videoView, final boolean disableDisconnectError) {
|
|
|
|
videoView.setDisableDisconnectError(disableDisconnectError);
|
|
|
|
}
|
|
|
|
|
2018-05-18 13:30:01 -07:00
|
|
|
@ReactProp(name = PROP_FULLSCREEN, defaultBoolean = false)
|
|
|
|
public void setFullscreen(final ReactExoplayerView videoView, final boolean fullscreen) {
|
|
|
|
videoView.setFullscreen(fullscreen);
|
|
|
|
}
|
|
|
|
|
2024-06-27 11:58:06 +02:00
|
|
|
@ReactProp(name = PROP_VIEW_TYPE, defaultInt = ViewType.VIEW_TYPE_SURFACE)
|
|
|
|
public void setViewType(final ReactExoplayerView videoView, final int viewType) {
|
|
|
|
videoView.setViewType(viewType);
|
2022-02-14 21:17:22 -04:00
|
|
|
}
|
|
|
|
|
2018-11-28 14:56:58 +02:00
|
|
|
@ReactProp(name = PROP_HIDE_SHUTTER_VIEW, defaultBoolean = false)
|
|
|
|
public void setHideShutterView(final ReactExoplayerView videoView, final boolean hideShutterView) {
|
|
|
|
videoView.setHideShutterView(hideShutterView);
|
|
|
|
}
|
|
|
|
|
2019-01-04 14:58:32 +05:30
|
|
|
@ReactProp(name = PROP_CONTROLS, defaultBoolean = false)
|
|
|
|
public void setControls(final ReactExoplayerView videoView, final boolean controls) {
|
|
|
|
videoView.setControls(controls);
|
|
|
|
}
|
|
|
|
|
2022-07-05 23:58:30 +02:00
|
|
|
@ReactProp(name = PROP_SUBTITLE_STYLE)
|
|
|
|
public void setSubtitleStyle(final ReactExoplayerView videoView, @Nullable final ReadableMap src) {
|
|
|
|
videoView.setSubtitleStyle(SubtitleStyle.parse(src));
|
|
|
|
}
|
|
|
|
|
2024-07-12 17:27:42 +09:00
|
|
|
@ReactProp(name = PROP_SHUTTER_COLOR, defaultInt = 0)
|
|
|
|
public void setShutterColor(final ReactExoplayerView videoView, final int color) {
|
|
|
|
videoView.setShutterColor(color == 0 ? Color.BLACK : color);
|
2023-07-23 21:38:26 +05:30
|
|
|
}
|
|
|
|
|
2018-08-03 15:54:55 -07:00
|
|
|
@ReactProp(name = PROP_BUFFER_CONFIG)
|
2018-08-02 09:20:08 +02:00
|
|
|
public void setBufferConfig(final ReactExoplayerView videoView, @Nullable ReadableMap bufferConfig) {
|
2024-05-06 22:04:40 +02:00
|
|
|
BufferConfig config = BufferConfig.parse(bufferConfig);
|
|
|
|
videoView.setBufferConfig(config);
|
2018-08-01 15:58:02 +02:00
|
|
|
}
|
|
|
|
|
2024-05-07 12:30:57 +02:00
|
|
|
@ReactProp(name = PROP_SHOW_NOTIFICATION_CONTROLS)
|
|
|
|
public void setShowNotificationControls(final ReactExoplayerView videoView, final boolean showNotificationControls) {
|
|
|
|
videoView.setShowNotificationControls(showNotificationControls);
|
|
|
|
}
|
|
|
|
|
2023-10-10 09:47:56 +02:00
|
|
|
@ReactProp(name = PROP_DEBUG, defaultBoolean = false)
|
|
|
|
public void setDebug(final ReactExoplayerView videoView,
|
|
|
|
@Nullable final ReadableMap debugConfig) {
|
|
|
|
boolean enableDebug = ReactBridgeUtils.safeGetBool(debugConfig, "enable", false);
|
|
|
|
boolean enableThreadDebug = ReactBridgeUtils.safeGetBool(debugConfig, "thread", false);
|
|
|
|
if (enableDebug) {
|
|
|
|
DebugLog.setConfig(Log.VERBOSE, enableThreadDebug);
|
|
|
|
} else {
|
|
|
|
DebugLog.setConfig(Log.WARN, enableThreadDebug);
|
|
|
|
}
|
2024-05-17 15:10:37 +02:00
|
|
|
videoView.setDebug(enableDebug);
|
2023-10-10 09:47:56 +02:00
|
|
|
}
|
|
|
|
|
2024-05-20 14:15:18 +03:30
|
|
|
@ReactProp(name = PROP_CONTROLS_STYLES)
|
|
|
|
public void setControlsStyles(final ReactExoplayerView videoView, @Nullable ReadableMap controlsStyles) {
|
|
|
|
ControlsConfig controlsConfig = ControlsConfig.parse(controlsStyles);
|
|
|
|
videoView.setControlsStyles(controlsConfig);
|
|
|
|
}
|
|
|
|
}
|