diff --git a/android/src/main/java/com/theoplayer/PlayerEventEmitter.kt b/android/src/main/java/com/theoplayer/PlayerEventEmitter.kt index 3e349bb9b..47d4b8e25 100644 --- a/android/src/main/java/com/theoplayer/PlayerEventEmitter.kt +++ b/android/src/main/java/com/theoplayer/PlayerEventEmitter.kt @@ -280,7 +280,10 @@ class PlayerEventEmitter internal constructor( fun preparePlayer(player: Player) { attachListeners(player) - + emitPlayerReady(player) + } + + fun emitPlayerReady(player: Player) { val payload = Arguments.createMap() payload.putMap( EVENT_PROP_STATE, diff --git a/android/src/main/java/com/theoplayer/ReactTHEOplayerView.kt b/android/src/main/java/com/theoplayer/ReactTHEOplayerView.kt index f3fc67ddc..eed36a20e 100644 --- a/android/src/main/java/com/theoplayer/ReactTHEOplayerView.kt +++ b/android/src/main/java/com/theoplayer/ReactTHEOplayerView.kt @@ -20,12 +20,12 @@ private const val TAG = "ReactTHEOplayerView" class ReactTHEOplayerView(private val reactContext: ThemedReactContext) : FrameLayout(reactContext), LifecycleEventListener { - private val eventEmitter: PlayerEventEmitter = + val eventEmitter: PlayerEventEmitter = PlayerEventEmitter(reactContext.reactApplicationContext, this) val broadcast = EventBroadcastAdapter(this) var presentationManager: PresentationManager? = null var playerContext: ReactTHEOplayerContext? = null - private var isInitialized: Boolean = false + var isInitialized: Boolean = false private var config: PlayerConfigAdapter? = null val adsApi: AdsApiWrapper diff --git a/ios/THEOplayerRCTView.swift b/ios/THEOplayerRCTView.swift index d6fdcb60b..e59ccd5ec 100644 --- a/ios/THEOplayerRCTView.swift +++ b/ios/THEOplayerRCTView.swift @@ -168,7 +168,7 @@ public class THEOplayerRCTView: UIView { } } - private func notifyNativePlayerReady() { + public func notifyNativePlayerReady() { DispatchQueue.main.async { let versionString = THEOplayer.version if let forwardedNativeReady = self.onNativePlayerReady { diff --git a/src/api/THEOplayerView.ts b/src/api/THEOplayerView.ts index f91ce35b8..9d31fe4d5 100644 --- a/src/api/THEOplayerView.ts +++ b/src/api/THEOplayerView.ts @@ -9,6 +9,11 @@ export interface THEOplayerViewProps { */ config?: PlayerConfiguration; + /** + * Render something instead of the player view. + */ + customPlayerRender?: (playerProps: any) => React.JSX.Element; + /** * The style applied to the player view. */ diff --git a/src/internal/THEOplayerView.tsx b/src/internal/THEOplayerView.tsx index 8a147b9b6..90ce94fe7 100644 --- a/src/internal/THEOplayerView.tsx +++ b/src/internal/THEOplayerView.tsx @@ -406,47 +406,49 @@ export class THEOplayerView extends PureComponent - + {customPlayerRender ? customPlayerRender({ ...playerProps }) : } {posterActive && } {children}