-
Notifications
You must be signed in to change notification settings - Fork 71
refactor(packages): improve webkit presentation API handling and button availability #1362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 5 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
16e196f
refactor(packages): improve webkit presentation API handling and butt…
mihar-22 375cf99
fix(packages): resolve typecheck failures in button tests and cast fe…
mihar-22 09cd58a
feat(packages): add `available` state and `data-available` attr to ca…
mihar-22 dfa78df
docs(core): add JSDoc to cast button data attrs
mihar-22 7274036
docs(core): add JSDoc to CastButtonState interface
mihar-22 b926c35
fix(core): correct pip feature event target and fullscreen-to-pip tra…
mihar-22 d8824ec
docs(design): document disabled and hidden states for controls
mihar-22 9abe153
refactor(packages)!: replace `available` state with `disabled` and `h…
mihar-22 393edb8
fix(core): sync pip state on play event
mihar-22 30c4dd0
fix(skin): replace old availability Tailwind classes with data-disabled
mihar-22 15c3a32
docs(site): add data-disabled styling examples to pip and fullscreen …
mihar-22 6ee1288
fix(test): skip pip button assertion when hidden on WebKit
mihar-22 516fbba
refactor(packages): propagate media button errors to caller instead o…
mihar-22 b4cdc2d
fix(core): guard webkit pip exit and fix api check order
mihar-22 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,66 @@ | ||
| import { isFunction, isObject } from '@videojs/utils/predicate'; | ||
|
|
||
| import type { | ||
| MediaBufferCapability, | ||
| MediaErrorCapability, | ||
| MediaFullscreenCapability, | ||
| MediaPauseCapability, | ||
| MediaPictureInPictureCapability, | ||
| MediaPlaybackRateCapability, | ||
| MediaRemotePlaybackCapability, | ||
| MediaSeekCapability, | ||
| MediaSourceCapability, | ||
| MediaTextTrackCapability, | ||
| MediaVolumeCapability, | ||
| } from './types'; | ||
|
|
||
| export function isMediaPauseCapable(value: unknown): value is MediaPauseCapability { | ||
| return isObject(value) && 'paused' in value && 'ended' in value && 'pause' in value && isFunction(value.pause); | ||
| } | ||
|
|
||
| export function isMediaSeekCapable(value: unknown): value is MediaSeekCapability { | ||
| return isObject(value) && 'currentTime' in value && 'duration' in value && 'seeking' in value; | ||
| } | ||
|
|
||
| export function isMediaSourceCapable(value: unknown): value is MediaSourceCapability { | ||
| return ( | ||
| isObject(value) && | ||
| 'src' in value && | ||
| 'currentSrc' in value && | ||
| 'readyState' in value && | ||
| 'load' in value && | ||
| isFunction(value.load) | ||
| ); | ||
| } | ||
|
|
||
| export function isMediaVolumeCapable(value: unknown): value is MediaVolumeCapability { | ||
| return isObject(value) && 'volume' in value && 'muted' in value; | ||
| } | ||
|
|
||
| export function isMediaPlaybackRateCapable(value: unknown): value is MediaPlaybackRateCapability { | ||
| return isObject(value) && 'playbackRate' in value; | ||
| } | ||
|
|
||
| export function isMediaBufferCapable(value: unknown): value is MediaBufferCapability { | ||
| return isObject(value) && 'buffered' in value && 'seekable' in value; | ||
| } | ||
|
|
||
| export function isMediaErrorCapable(value: unknown): value is MediaErrorCapability { | ||
| return isObject(value) && 'error' in value; | ||
| } | ||
|
|
||
| export function isMediaTextTrackCapable(value: unknown): value is MediaTextTrackCapability { | ||
| return isObject(value) && 'textTracks' in value; | ||
| } | ||
|
|
||
| export function isMediaRemotePlaybackCapable(value: unknown): value is MediaRemotePlaybackCapability { | ||
| return isObject(value) && 'remote' in value && isObject(value.remote); | ||
| } | ||
|
|
||
| export function isMediaFullscreenCapable(value: unknown): value is MediaFullscreenCapability { | ||
| return isObject(value) && 'requestFullscreen' in value && isFunction(value.requestFullscreen); | ||
| } | ||
|
|
||
| export function isMediaPictureInPictureCapable(value: unknown): value is MediaPictureInPictureCapability { | ||
| return isObject(value) && 'requestPictureInPicture' in value && isFunction(value.requestPictureInPicture); | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,4 +1,8 @@ | ||
| import type { Audio, AudioEvents } from '../../core/media/types'; | ||
| import { HTMLMediaElementHost } from './media-host'; | ||
|
|
||
| export class HTMLAudioElementHost extends HTMLMediaElementHost<HTMLAudioElement, AudioEvents> implements Audio {} | ||
| export const AUDIO_ELEMENT_HOST_SYMBOL = Symbol.for('@videojs/audio-element-host'); | ||
|
|
||
| export class HTMLAudioElementHost extends HTMLMediaElementHost<HTMLAudioElement, AudioEvents> implements Audio { | ||
| readonly [AUDIO_ELEMENT_HOST_SYMBOL] = true; | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.