-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: split interfaces and implementations for player and player view
- Loading branch information
1 parent
d3590d0
commit 6c89276
Showing
9 changed files
with
218 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { PlayerViewEvents } from './events'; | ||
import { Player } from '../../player'; | ||
import { FullscreenHandler, CustomMessageHandler } from '../../ui'; | ||
import { ScalingMode } from '../../styleConfig'; | ||
import { PictureInPictureConfig } from './pictureInPictureConfig'; | ||
import { ViewStyle } from 'react-native'; | ||
/** | ||
* Base `PlayerView` component props. Used to establish common | ||
* props between `NativePlayerView` and `PlayerView`. | ||
* @see NativePlayerView | ||
*/ | ||
export interface BasePlayerViewProps { | ||
/** | ||
* The `FullscreenHandler` that is used by the `PlayerView` to control the fullscreen mode. | ||
*/ | ||
fullscreenHandler?: FullscreenHandler; | ||
|
||
/** | ||
* The `CustomMessageHandler` that can be used to directly communicate with the embedded Bitmovin Web UI. | ||
*/ | ||
customMessageHandler?: CustomMessageHandler; | ||
/** | ||
* Style of the `PlayerView`. | ||
*/ | ||
style?: ViewStyle; | ||
|
||
/** | ||
* Provides options to configure Picture in Picture playback. | ||
*/ | ||
pictureInPictureConfig?: PictureInPictureConfig; | ||
} | ||
|
||
/** | ||
* `PlayerView` component props. | ||
* @see PlayerView | ||
*/ | ||
export interface PlayerViewProps extends BasePlayerViewProps, PlayerViewEvents { | ||
/** | ||
* `Player` instance (generally returned from `usePlayer` hook) that will control | ||
* and render audio/video inside the `PlayerView`. | ||
*/ | ||
player: Player; | ||
|
||
/** | ||
* Can be set to `true` to request fullscreen mode, or `false` to request exit of fullscreen mode. | ||
* Should not be used to get the current fullscreen state. Use `onFullscreenEnter` and `onFullscreenExit` | ||
* or the `FullscreenHandler.isFullscreenActive` property to get the current state. | ||
* Using this property to change the fullscreen state, it is ensured that the embedded Player UI is also aware | ||
* of potential fullscreen state changes. | ||
* To use this property, a `FullscreenHandler` must be set. | ||
*/ | ||
isFullscreenRequested?: Boolean; | ||
|
||
/** | ||
* A value defining how the video is displayed within the parent container's bounds. | ||
* Possible values are defined in `ScalingMode`. | ||
*/ | ||
scalingMode?: ScalingMode; | ||
|
||
/** | ||
* Can be set to `true` to request Picture in Picture mode, or `false` to request exit of Picture in Picture mode. | ||
* Should not be used to get the current Picture in Picture state. Use `onPictureInPictureEnter` and `onPictureInPictureExit. | ||
*/ | ||
isPictureInPictureRequested?: Boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './PlayerView'; | ||
export * from './PlayerView/pictureInPictureConfig'; | ||
export * from './PlayerView/properties'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/** | ||
* Configures the playback behaviour of the player. | ||
*/ | ||
export interface PlaybackConfig { | ||
/** | ||
* Whether the player starts playing automatically after loading a source or not. Default is `false`. | ||
* @example | ||
* ``` | ||
* const player = new Player({ | ||
* playbackConfig: { | ||
* isAutoplayEnabled: true, | ||
* }, | ||
* }); | ||
* ``` | ||
*/ | ||
isAutoplayEnabled?: boolean; | ||
/** | ||
* Whether the sound is muted on startup or not. Default value is `false`. | ||
* @example | ||
* ``` | ||
* const player = new Player({ | ||
* playbackConfig: { | ||
* isMuted: true, | ||
* }, | ||
* }); | ||
* ``` | ||
*/ | ||
isMuted?: boolean; | ||
/** | ||
* Whether time shift / DVR for live streams is enabled or not. Default is `true`. | ||
* @example | ||
* ``` | ||
* const player = new Player({ | ||
* playbackConfig: { | ||
* isTimeShiftEnabled: false, | ||
* }, | ||
* }); | ||
* ``` | ||
*/ | ||
isTimeShiftEnabled?: boolean; | ||
/** | ||
* Whether background playback is enabled or not. | ||
* Default is `false`. | ||
* | ||
* When set to `true`, playback is not automatically paused | ||
* anymore when the app moves to the background. | ||
* When set to `true`, also make sure to properly configure your app to allow | ||
* background playback. | ||
* | ||
* On tvOS, background playback is only supported for audio-only content. | ||
* | ||
* Default is `false`. | ||
* | ||
* @example | ||
* ``` | ||
* const player = new Player({ | ||
* { | ||
* isBackgroundPlaybackEnabled: true, | ||
* } | ||
* }) | ||
* ``` | ||
*/ | ||
isBackgroundPlaybackEnabled?: boolean; | ||
/** | ||
* Whether the Picture in Picture mode option is enabled or not. Default is `false`. | ||
* @example | ||
* ``` | ||
* const player = new Player({ | ||
* playbackConfig: { | ||
* isPictureInPictureEnabled: true, | ||
* }, | ||
* }); | ||
* ``` | ||
* @deprecated Use {@link PictureInPictureConfig.isEnabled} instead. | ||
*/ | ||
isPictureInPictureEnabled?: boolean; | ||
} |
Oops, something went wrong.