Options
All
  • Public
  • Public/Protected
  • All
Menu
summary

React Native Player Plugin which wraps React Native View RCTOTVPlayerView.

see

React.Component

Hierarchy

  • Component<OTVPlayerProps>
    • default

Index

Constructors

constructor

  • new default(props: OTVPlayerProps): default
  • constructs
    summary

    A wrapper class of React Native component RCTOTVPlayerView.

    description

    Create this component as a sub-component in your application. Set the properties and event callback to it in render() function. Manage the configurable properties of this component in its parent component of your application.

    example
    render() {
        return(<View>
            <OTVPlayer ref={otvplayer => this.otvplayer.ref = otvplayer}
                style={styles.player.video}
                source={
                    src: "https://BigBuckBunny.mpd,
                    type: "application/dash+xml"
                    token: "base64 token",
                    adTagURL: "https://this.is.a.url.to.an.IMA.ad",
                    textTracks: [{
                        url: "https://BigBuckBunny.subtitles.srt",
                        mimeType: "application/x-subrip",
                        language: "eng"
                    }],
                    drm: {
                        type: "Widevine",
                        certificateURL: "certificate server URL",
                        licenseURL: "license server URL",
                        ssmServerURL: "SSM server URL",
                        ssmSyncMode: 0
                    }
                }
                autoplay={true}
                progressUpdateInterval={1000}
                muted={false}
                volume={1.0}
                onLoadStart={ console.log("OnLoadStart event called"); }
                onLoad={ console.log("OnLoad event called"); }
                onProgress={ console.log("onProgress event called"); }
                onPaused={ console.log("onPaused event called"); }
                onPlay={ console.log("onPlay event called"); }
                onEnd={ console.log("onEnd event called"); }
                onTracksChanged={ console.log("onTracksChanged event called"); }
                onAudioTrackSelected={ console.log("onAudioTrackSelected event called"); }
                onTextTrackSelected={ console.log("onTextTrackSelected event called"); }
                onError={ console.log("onError event called"); }
                onWaiting={ console.log("onWaiting event called"); }
                 onPlaying={ console.log("onPlaying event called"); }
                >
            </OTVPlayer>
         </View>)
    }
    

    Parameters

    • props: OTVPlayerProps

      Properties set to player.

    Returns default

Properties

context

context: any

If using the new style context, re-declare this in your class to be the React.ContextType of your static contextType. Should be used with type annotation or static contextType.

static contextType = MyContext
// For TS pre-3.7:
context!: React.ContextType<typeof MyContext>
// For TS 3.7 and above:
declare context: React.ContextType<typeof MyContext>
see

https://reactjs.org/docs/context.html

Readonly props

props: Readonly<OTVPlayerProps> & Readonly<{ children?: ReactNode }>

refs

refs: {}

Type declaration

  • [key: string]: ReactInstance

state

state: Readonly<{}>

Static Optional contextType

contextType: Context<any>

If set, this.context will be set at runtime to the current value of the given Context.

Usage:

type MyContext = number
const Ctx = React.createContext<MyContext>(0)

class Foo extends React.Component {
  static contextType = Ctx
  context!: React.ContextType<typeof Ctx>
  render () {
    return <>My context's value: {this.context}</>;
  }
}
see

https://reactjs.org/docs/context.html#classcontexttype

Static defaultProps

defaultProps: { autoplay: boolean; muted: boolean; progressUpdateInterval: number; volume: number } = ...

Type declaration

  • autoplay: boolean
  • muted: boolean
  • progressUpdateInterval: number
  • volume: number

Methods

Optional UNSAFE_componentWillMount

  • UNSAFE_componentWillMount(): void

Optional UNSAFE_componentWillReceiveProps

  • UNSAFE_componentWillReceiveProps(nextProps: Readonly<OTVPlayerProps>, nextContext: any): void

Optional UNSAFE_componentWillUpdate

  • UNSAFE_componentWillUpdate(nextProps: Readonly<OTVPlayerProps>, nextState: Readonly<{}>, nextContext: any): void

Optional componentDidCatch

  • componentDidCatch(error: Error, errorInfo: ErrorInfo): void
  • Catches exceptions generated in descendant components. Unhandled exceptions will cause the entire component tree to unmount.

    Parameters

    • error: Error
    • errorInfo: ErrorInfo

    Returns void

Optional componentDidMount

  • componentDidMount(): void
  • Called immediately after a component is mounted. Setting state here will trigger re-rendering.

    Returns void

Optional componentDidUpdate

  • componentDidUpdate(prevProps: Readonly<OTVPlayerProps>, prevState: Readonly<{}>, snapshot?: any): void
  • Called immediately after updating occurs. Not called for the initial render.

    The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.

    Parameters

    • prevProps: Readonly<OTVPlayerProps>
    • prevState: Readonly<{}>
    • Optional snapshot: any

    Returns void

Optional componentWillMount

  • componentWillMount(): void

Optional componentWillReceiveProps

  • componentWillReceiveProps(nextProps: Readonly<OTVPlayerProps>, nextContext: any): void

Optional componentWillUnmount

  • componentWillUnmount(): void
  • Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as cancelled network requests, or cleaning up any DOM elements created in componentDidMount.

    Returns void

Optional componentWillUpdate

  • componentWillUpdate(nextProps: Readonly<OTVPlayerProps>, nextState: Readonly<{}>, nextContext: any): void

forceUpdate

  • forceUpdate(callback?: () => void): void
  • Parameters

    • Optional callback: () => void
        • (): void
        • Returns void

    Returns void

Optional getSnapshotBeforeUpdate

  • getSnapshotBeforeUpdate(prevProps: Readonly<OTVPlayerProps>, prevState: Readonly<{}>): any
  • Runs before React applies the result of render to the document, and returns an object to be given to componentDidUpdate. Useful for saving things such as scroll position before render causes changes to it.

    Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated lifecycle events from running.

    Parameters

    • prevProps: Readonly<OTVPlayerProps>
    • prevState: Readonly<{}>

    Returns any

pause

  • pause(): void
  • function
    summary

    Pause the playback of the media data.

    description

    Before calling this method this.props.source must be set.

    After calling this method {@link OTVPlayer.propTypes.onPaused} event is triggered

    Returns void

play

  • play(): void
  • function
    summary

    Start or resume playback of media data.

    description

    Before calling this method, this.props.source must be set.

    After calling this method, {@link OTVPlayer.propTypes.onPlay} event is triggered.

    Callback {@link OTVPlayer.propTypes.onProgress} is called when media data is playing in progress.

    Callback {@link OTVPlayer.propTypes.onWaiting} is called when the playback gets stalled.

    Returns void

seek

  • seek(position: number, tolerance?: number): void
  • function
    summary

    Set the current playback position of the media data.

    description

    Before calling this method, this.props.source must be set.

    Callback {@link OTVPlayer.propTypes.onSeek} is called when the seeking completes.

    see

    {@link OTVPlayer.propTypes.onSeek}

    Parameters

    • position: number

      The position in seconds.

    • tolerance: number = 100

      The tolerance in milliseconds of the seeking accuracy. Only Applicable for iOS/tvOS. Default value is 100.

    Returns void

selectAudioTrack

  • selectAudioTrack(index: number): void
  • function
    summary

    Select one audio track to render.

    description

    Calling this method only when you receive the available tracks from callback {@link OTVPlayer.propTypes.onTracksChanged}. After calling this method, {@link OTVPlayer.propTypes.onTracksChanged} is triggerded and the selectedAudioTrack from the event is updated

    see

    {@link OTVPlayer.propTypes.onTracksChanged}

    Parameters

    • index: number

    Returns void

selectTextTrack

  • selectTextTrack(index: number): void
  • function
    summary

    Select one text track to render.

    description

    Calling this method only when you receive the available tracks from callback {@link OTVPlayer.propTypes.onTracksChanged}. After calling this method, {@link OTVPlayer.propTypes.onTracksChanged} is triggerded and the selectedTextTrack from the event is updated

    see

    {@link OTVPlayer.propTypes.onTracksChanged}

    Parameters

    • index: number

    Returns void

setState

  • setState<K>(state: {} | ((prevState: Readonly<{}>, props: Readonly<OTVPlayerProps>) => {} | Pick<{}, K>) | Pick<{}, K>, callback?: () => void): void
  • Type parameters

    • K: never

    Parameters

    • state: {} | ((prevState: Readonly<{}>, props: Readonly<OTVPlayerProps>) => {} | Pick<{}, K>) | Pick<{}, K>
    • Optional callback: () => void
        • (): void
        • Returns void

    Returns void

Optional shouldComponentUpdate

  • shouldComponentUpdate(nextProps: Readonly<OTVPlayerProps>, nextState: Readonly<{}>, nextContext: any): boolean
  • Called to determine whether the change in props and state should trigger a re-render.

    Component always returns true. PureComponent implements a shallow comparison on props and state and returns true if any props or states have changed.

    If false is returned, Component#render, componentWillUpdate and componentDidUpdate will not be called.

    Parameters

    • nextProps: Readonly<OTVPlayerProps>
    • nextState: Readonly<{}>
    • nextContext: any

    Returns boolean

Generated using TypeDoc