-
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.
Merge pull request #300 from bitmovin/typescript-improvements
Split interfaces and implementations for `Player` and `PlayerView`
- Loading branch information
Showing
9 changed files
with
225 additions
and
218 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,72 @@ | ||
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'; | ||
import { PlayerViewConfig } from './playerViewConfig'; | ||
|
||
/** | ||
* Base `PlayerView` component props. | ||
* Used to establish common props between `NativePlayerView` and {@link PlayerView}. | ||
*/ | ||
export interface BasePlayerViewProps { | ||
/** | ||
* The {@link FullscreenHandler} that is used by the {@link PlayerView} to control the fullscreen mode. | ||
*/ | ||
fullscreenHandler?: FullscreenHandler; | ||
|
||
/** | ||
* The {@link CustomMessageHandler} that can be used to directly communicate with the embedded Bitmovin Web UI. | ||
*/ | ||
customMessageHandler?: CustomMessageHandler; | ||
|
||
/** | ||
* Style of the {@link PlayerView}. | ||
*/ | ||
style?: ViewStyle; | ||
|
||
/** | ||
* Provides options to configure Picture in Picture playback. | ||
*/ | ||
pictureInPictureConfig?: PictureInPictureConfig; | ||
|
||
/** | ||
* Configures the visual presentation and behaviour of the {@link PlayerView}. | ||
* The value must not be altered after setting it initially. | ||
*/ | ||
config?: PlayerViewConfig; | ||
} | ||
|
||
/** | ||
* {@link PlayerView} component props. | ||
*/ | ||
export interface PlayerViewProps extends BasePlayerViewProps, PlayerViewEvents { | ||
/** | ||
* {@link Player} instance (generally returned from {@link usePlayer} hook) that will control | ||
* and render audio/video inside the {@link 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 {@link PlayerViewEvents.onFullscreenEnter} and {@link PlayerViewEvents.onFullscreenExit} | ||
* or the {@link 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 {@link 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 {@link 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 {@link PlayerViewEvents.onPictureInPictureEnter} and {@link PlayerViewEvents.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,3 +1,4 @@ | ||
export * from './PlayerView'; | ||
export * from './PlayerView/pictureInPictureConfig'; | ||
export * from './PlayerView/playerViewConfig'; | ||
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.