Giter Club home page Giter Club logo

player's Introduction

Vidstack Player

package-badge react-package-badge discord-badge

Build and ship a production-ready video or audio player! Robust, customizable, and accessible. The successor to Plyr 3.x and Vime 5.x.

Quickstart

Our library works with any of the JavaScript frameworks listed below. You can decide to build your own player layout using our components, or you can take advantage of our pre-built layouts to get up and running quickly! See any of the following links to get started.

Installation:

Resources:

Documentation

If you'd like to learn more about Vidstack Player, you can find our documentation on our website:

Player Documentation

Community

If you need help with anything related to Vidstack, or if you'd like to casually chit-chat with other members:

Thanks ❤️

A special thanks to the following organizations who are kindly supporting Vidstack with sponsored accounts:

player's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

player's Issues

Text Tracks Support

Tasks

Design and implement an interface to support retrieving and setting text tracks across providers.

API

Player API

  • textTracks: TextTrack[]
  • currentTextTrack: number
  • isTextTrackVisible: boolean

Player Methods

  • setCurrentTextTrack(track: number | TextTrack): void
  • setTextTrackVisibility(isVisible: boolean): void

Media Events

  • text-tracks-change
  • current-text-track-change
  • text-track-visiblity-change

Media Request Events

  • media-show-text-tracks-request
  • media-hide-track-tracks-request

Provider API

  • Provider's need to expose an optional textTracks object with the following fields: textTracks, currentTextTrack, visible, supported, setTextTrack (this will be undefined if not possible), and setVisibility.

References

HideCaptionsControl

Tasks

  • Complete #22.
  • Complete #28.
  • Design, build and test the HideCaptionsControl component.

Notes

Slots

  • default: Used to pass in a styled element to give the component form.

CSS Parts

Forward all Control parts.

Events

  • vds-hide-captions-control-pressed: UI event emitted when the component is pressed.
  • vds-user-hide-captions-request: UI event emitted when the component is pressed to hide captions.

References

Playback Quality Support

Tasks

Design and implement an interface to support getting/setting playbackQuality across providers.

API

Player API

  • playbackQuality: string
  • playbackQualities: string[]

Media Events

  • playback-quality-change

Media Request Events

  • media-playback-quality-change-request

Important

  • playbackQuality can only be set to a valid value in playbackQuality.
  • What to do if playback quality is not supported?

References

Basic Player Component

Tasks

  • PlayerState interface (reference).
  • Define basic events interface for Player/Providers/UI.
  • PlayerContext object (reference).
  • Connect and test connection between PlayerContext to Player.

Notes

This is the first component required as it sits at the top of the component hierarchy. We'll start with the most basic player API:

Properties

  • src
  • volume
  • currentTime
  • paused
  • poster
  • muted
  • aspectRatio
  • duration (readonly)
  • buffered (readonly)
  • isMobile (readonly)
  • isTouch (readonly)
  • isBuffering (readonly)
  • isPlaying (readonly)
  • hasPlaybackStarted (readonly)
  • hasPlaybackEnded (readonly)
  • isPlaybackReady (readonly)
  • viewType (readonly)
  • isAudioView (readonly)
  • isVideoView (readonly)
  • mediaType (readonly)
  • isAudio (readonly)
  • isVideo (readonly)

Events

  • vds-src-change
  • vds-volume-change
  • vds-current-time-change
  • vds-poster-change
  • vds-buffered-change
  • vds-buffering-change
  • vds-aspect-ratio-change
  • vds-play
  • vds-pause
  • vds-playing
  • vds-duration-change
  • vds-playback-start
  • vds-playback-end
  • vds-playback-ready
  • vds-view-Type-change
  • vds-media-Type-change
  • vds-mobile-change
  • vds-touch-change
  • vds-error

UI Events

  • vds-user-play-request
  • vd-user-pause-request
  • vds-user-mute-request
  • vds-user-unmute-request
  • vds-user-volume-change-request
  • vds-user-current-time-change-request

Provider Events

  • vds-provider-play
  • vds-provider-pause
  • vds-provider-playing
  • vds-provider-buffered
  • vds-provider-view-type-change
  • vds-provider-media-type-change
  • vds-provider-playback-ready
  • vds-provider-playback-start
  • vds-provider-playback-end
  • vds-provider-current-time-change
  • vds-provider-duration-change
  • vds-provider-volume-change
  • vds-provider-buffering-start
  • vds-provider-buffering-end
  • vds-provider-error

References

TogglePlaybackControl

Tasks

  • Complete #29.
  • Complete #30.
  • Complete #31.
  • Design, build and test the TogglePlaybackControl component.

Notes

Slots

  • play: Used to pass in a styled element to give the component form when the paused state is true.
  • pause: Used to pass in a styled element to give the component form when the paused state is false.

CSS Parts

  • control-* and play-control-*: Forward all Control parts and forward them again but this time prefixed with play-.
  • control-* and pause-control-*: Forward all Control parts and forward them again but this time prefixed with pause-.
<!-- Example -->
<vds-play-control 
  exportparts="control, control-focused, ..., control: play-control, control-focused: play-control-focused"
>
  <slot name="play"></slot>
</vds-play-control>

References

Fullscreen Support

Tasks

  • Design an interface to support entering and exiting fullscreen across browsers/providers.

Notes

This will expand the player API:

Properties

  • isFullscreenActive: boolean

Methods

  • enterFullscreen(options?: FullscreenOptions): Promise<void>
  • exitFullscreen(): Promise<void>

Events

  • vds-fullscreen-change
  • vds-user-enter-fullscreen-request
  • vds-user-exit-fullscreen-request
  • vds-provider-entered-fullscreen
  • vds-provider-exited-fullscreen

Important

  • How to know if the current provider supports enterting/exiting fullscreen? The interface designed should account for this. Vime achieved this through a canSetFullscreen() method. UI components need to know if this operation is possible so it might be preferable to include this in the PlayerContext somehow.
  • How to handle the fact that multiple elements might be fullscreened at the same time (stacked on top of each other)?
  • Handle if PiP is active. Exit it first before entering fullscreen (should it be set back on exit?).

References

CloseSettingsControl

Tasks

  • Complete #28.
  • Complete #53.
  • Design, build and test the CloseSettingsControl component.

Notes

Slots

  • default: Used to pass in a styled element to give the component form.

CSS Parts

Forward all Control parts.

Events

  • vds-close-settings-control-pressed: UI event emitted when the component is pressed.
  • vds-user-close-settings-request: UI event emitted when the component is pressed to request closing the settings.

References

Audio Tracks Support

Tasks

Design and implement an interface to support retreiving and setting audio tracks across providers.

API

Player API

  • audioTracks: AudioTrack[]
  • currentAudioTrack: AudioTrack

Player Methods

  • setCurrentAudioTrack(trackId: number): Promise<void>

Media Events

  • audio-tracks-change
  • current-audio-track-change

Media Request Events

  • media-audio-track-change-request

Notes

  • There's no native interface for an AudioTrack, how can this be designed across providers?
  • What to do if setting audio tracks is not supported?

References

PauseControl

Tasks

  • Complete #28.
  • Design, build and test the PauseControl component.

Notes

Slots

  • default: Used to pass in a styled element to give the component form.

CSS Parts

Forward all Control parts.

Events

  • vds-user-pause-request: UI event emitted when the component is pressed and to pause playback.

References

Media File Provider

Tasks

  • Complete #5.
  • Build and test MediaFileProvider class.

Notes

This class will need to query and cache the MediaElement loaded in the DOM. This object should be used to build out concrete implementations of the MediaProvider class.

// Example.

abstract class MediaFileProvider extends MediaProvider<HTMLMediaElement> {
 // Let the Audio or Video provider handle implementing it so you can query the correct element (audio/video).
 protected abstract mediaEl?: HTMLMediaElement;

  getMediaEl() {
    // Maybe throw an error if called early?
    if (isUndefined(this.mediaEl)) throw Error('...');
    return this.mediaEl!;
  }

  getPaused() {
    return this.getMediaEl().paused;
  }
}

References

PressToPlay

Tasks

  • Design, build and test PressToPlay component,

Notes

Press is a more generic word that encompasses click, touch and keyboard triggered events.

Slots

  • default: Used to define the region that is pressable.

CSS Properties

  • --vds-ptp-z-index: The position in the UI z-axis stack inside the player.

CSS Parts

  • ptp
  • ptp-active

Events

  • vds-user-play-request: UI event emitted when the component is pressed and beings/resumes playback.
  • vds-user-pause-request: UI event emitted when the component is pressed and pauses playback.

References

Cross-component communication channel

Tasks

  • Design and implement an interface for enabling components to communicate with each other.

Notes

It's important to be aware that components will mount the DOM at different times, so the final solution will need account for this.

Examples

  • Controls needs to be aware of components such as captions/settings to implement collision detection.
  • IconLibrary needs to be aware of icons so when the icon library changes all icons can be redrawn.
  • Settings needs to be aware of any controller that will be used to open/close it.

References

Playback Rate Support

Tasks

Design and implement an interface to support getting/setting playbackRate across providers.

API

Player API

  • playbackRate: number
  • playbackRates: number[]

Media Events

  • playback-rate-change

Media RequestEvents

  • media-playback-rate-change-request

Important

  • playbackRate can only be set to a valid value in playbackRates.
  • What to do if it's not supported?

References

PlayControl

Tasks

  • Complete #28.
  • Design, build and test the PlayControl component.

Notes

Slots

  • default: Used to pass in a styled element to give the component form.

CSS Parts

Forward all Control parts.

Events

  • vds-user-play-request: UI event emitted when the component is pressed and beings/resumes playback.

References

Settings Support

Tasks

  • Design and implement an interface to support a settings menu.

Notes

This will expand the player API:

Properties

  • isSettingsOpen: boolean (readonly): Whether the settings menu is open.

Methods

  • openSettingsMenu(): void
  • closeSettingsMenu(): void

Events

  • vds-settings-opened
  • vds-settings-closed
  • vds-user-open-settings-request
  • vds-user-close-settings-request
  • vds-register-settings-menu
  • vds-deregister-settings-menu

ToggleMuteControl

Tasks

  • Complete #29.
  • Complete #33.
  • Complete #34.
  • Design, build and test the ToggleMuteControl component.

Notes

Slots

  • mute: Used to pass in a styled element to give the component form when the muted state is false.
  • unmute: Used to pass in a styled element to give the component form when the muted state is true.

CSS Parts

  • control-* and mute-control-*: Forward all Control parts and forward them again but this time prefixed with mute-.
  • control-* and unmute-control-*: Forward all Control parts and forward them again but this time prefixed with unmute-.
<!-- Example -->
<vds-mute-control
  exportparts="control, control-focused, ..., control: mute-control, mute-focused: mute-control-focused"
>
  <slot name="mute"></slot>
</vds-mute-control>

References

Scrubber

Tasks

  • Complete #48.
  • Design, build and test the Scrubber component.

Notes

Can this component be functional?

CSS Properties

https://github.com/vime-js/vime/blob/master/core/src/components/ui/controls/scrubber-control/scrubber-control.css

CSS Parts

  • scrubber
  • slider: Forward underlying <vds-slider> parts.
  • progress

Events

  • vds-user-seeking-request: Emitted when the user is scrubbing merely along without stopping.
  • vds-user-seeked-request: Emitted when the user stops scrubbing merely along.

References

ShowCaptionsControl

Tasks

  • Complete #22.
  • Complete #28.
  • Design, build and test the ShowCaptionsControl component.

Notes

Slots

  • default: Used to pass in a styled element to give the component form.

CSS Parts

Forward all Control parts.

Events

  • vds-show-captions-control-pressed: UI event emitted when the component is pressed.
  • vds-user-show-captions-request: UI event emitted when the component is pressed to show captions.

References

Controls

Tasks

  • Complete #56.
  • Design, build and test the Controls component.

Notes

Slots

  • default: Used to pass in individual controls or control groups.

CSS Properties

  • --vds-controls-padding: The padding inside the controls.
  • --vds-controls-bg-color: The background color of the controls.
  • --vds-controls-border-radius: The border radius of the controls.
  • --vds-controls-spacing: The space between individual controls.
  • --vds-controls-z-index: The position in the UI z-axis stack inside the player.

CSS Parts

  • controls
  • controls-audio
  • controls-video
  • controls-disabled
  • controls-active

Events

  • vds-user-show-controls-request
  • vds-user-hide-controls-request

References

Picture-in-Picture Support

Tasks

Design and implement an interface to support entering and exiting picture-in-picture (PiP) across browsers/providers.

API

Player API

  • pictureInPicture.active: boolean
  • pictureInPicture.supported: boolean

Player Methods

  • enterPictureInPicture(): Promise<void>
  • exitPictureInPicture(): Promise<void>

Events

  • picture-in-picture-change
  • media-enter-pip-request
  • media-exit-pip-request

Provider API

  • Provider's need to expose a picture-in-picture API similar to the on available on the player and the existing fullscreen API.

Notes

  • Careful when entering/exiting fullscreen - toggle PiP correctly.

References

ToggleFullscreenControl

Tasks

  • Complete #29.
  • Complete #36.
  • Complete #37.
  • Design, build and test the ToggleFullscreenControl component.

Notes

Slots

  • enter: Used to pass in a styled element to give the component form when the isFullscreenActive state is true.
  • exit: Used to pass in a styled element to give the component form when the isFullscreenActive state is false.

CSS Parts

  • control-* and enter-control-*: Forward all Control parts and forward them again but this time prefixed with enter-.
  • control-* and exit-control-*: Forward all Control parts and forward them again but this time prefixed with exit-.
<!-- Example -->
<vds-enter-fullscreen-control 
  exportparts="control, control-focused, ..., control: enter-control, control-focused: enter-control-focused"
>
  <slot name="enter"></slot>
</vds-enter-fullscreen-control>

References

UnmuteControl

Tasks

  • Complete #28.
  • Design, build and test the UnmuteControl component.

Notes

Slots

  • default: Used to pass in a styled element to give the component form.

CSS Parts

Forward all Control parts.

Events

  • vdsUserUnmuteRequest: UI event emitted when the component is pressed to unmute volume.

References

Control

Tasks

  • Design, build and test the Control component.

Notes

Methods

  • getHeight(): number
  • focusControl(): void
  • blurControl(): void

Slots

  • default: Used to pass in a styled element to give the component form.

CSS Parts

  • control
  • control-hovered
  • control-touch
  • control-mobile
  • control-active
  • control-haspopup
  • control-expanded
  • control-pressed
  • control-focused
  • control-tap-feedback

Events

  • vds-control-focus
  • vds-control-blur

References

DoublePressToFullscreen

Tasks

  • Design, build and test DoublePressToFullscreen component,

Notes

Press is a more generic word that encompasses click, touch and keyboard triggered events.

Slots

  • default: Used to define the region that is pressable.

CSS Properties

  • --vds-dptf-z-index: The position in the UI z-axis stack inside the player.

CSS Parts

  • dptf
  • dptf-active

Events

  • vds-user-enter-fullscreen-request: UI event emitted when the component is pressed to enter fullscreen.
  • vds-user-exit-fullscreen-request: UI event emitted when the component is pressed to exit fullscreen.

References

OpenSettingsControl

Tasks

  • Complete #28.
  • Complete #53.
  • Design, build and test the OpenSettingsControl component.

Notes

Slots

  • default: Used to pass in a styled element to give the component form.

CSS Parts

Forward all Control parts.

Events

  • vds-open-settings-control-pressed: UI event emitted when the component is pressed.
  • vds-user-open-settings-request: UI event emitted when the component is pressed to request opening the settings.

References

Toggle

Tasks

  • Complete #28.
  • Design, build and test the Toggle component.

Notes

When implementing this component careful not to prevent consumers from animating between states. Both slots should be rendered. As both slots expect a Control component, the hidden attribute can be set to indicate which control is active. This can let the consumer decide how to handle the transition between toggled states.

Slots

These slots are defined by static properties on the subclass.

  • ON_SLOT_NAME: Used to pass in a control when the toggle is on.
  • OFF_SLOT_NAME: Used to pass in a control when the toggle is off.

References

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.