1.0.0 • Published 4 years ago

@power-elements/shaka-player v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

shaka-player

Custom element wrapper for google's Shaka Player

Usage

<shaka-player
   autoplay
   controls
   dash-manifest="http://rdmedia.bbc.co.uk/dash/ondemand/bbb/2/client_manifest-common_init.mpd"
></shaka-player>

Properties

PropertyAttributeModifiersTypeDefaultDescription
allowCrossSiteCredentialsallow-cross-site-credentialsbooleanWhether shaka player should use cookies for CORS requests.
autoplayautoplaybooleanfalseWhether the video should auto-play.
canPlayreadonlybooleanWhether the video can play.
controlscontrolsbooleanWhether to display controls over the video.
currentTimecurrentTimenumberVideo's current time
dashManifestdash-manifeststringURL to the MPEG-DASH manifest
durationreadonlynumberThe duration of the video in seconds.
endedreadonlybooleanWhether or not the video playback has ended.
hlsManifesthls-manifeststringURL to the HLS manifest
loadingloadingbooleanfalseWhether the video is loading
mutedmutedbooleanfalseWhether the video is muted.
pausedreadonlybooleanWhether the video is paused.
playingplayingbooleanWhether the video is playing.
posterposterstringThe src URL for the poster frame.
preloadpreload'none'\|'metadata'\|'auto'\|''"metadata"Video element preload value.
readyStatereadonlynumberReady state of the video element.
srcsrcstringURL to a video file
volumenumber1The volume level of the video.

Methods

MethodTypeDescription
load(manifestUri: string, startTime?: number \| undefined, manifestMimeType?: string \| undefined): PromiseLoad a Manifest.startTime: Optional start time, in seconds, to begin playback. Defaults to 0 for VOD and to the live edge for live. Set a positive number to start with a certain offset the beginning. Set a negative number to start with a certain offset from the end. This is intended for use with live streams, to start at a fixed offset from the live edge.manifestMimeType: Optional mimetype registered using shaka.media.ManifestParser.register(mimeType, ParserClass)
loadManifest(manifestUri: string): PromiseLoad a manifest URL into shaka player.
loadVideo(url: string): stringLoad a regular video URL.
notify(property: any): void
pause(): anyPauses the player.
play(): PromisePlays the player.
unload(reinitializeMediaSource?: boolean \| undefined): Promise<void>Unload the current manifest and make the Player available for re-use.reinitializeMediaSource: If true, start reinitializing MediaSource right away. This can improve load() latency for MediaSource-based playbacks. Defaults to true.

Events

EventDescription
errorfired when shaka player errors
init-shaka-playerfired when shaka player is initialized
manifest-loadedfired when shaka player loads the manifest file

CSS Custom Properties

PropertyDescription
--shaka-player-background-colorThe background color of the video element. Default: black
--shaka-player-object-fitobject-fit property of the video element. Default: initial
--shaka-player-video-heightheight property of the video element. Default: auto
--shaka-player-video-widthwidth property of the video element. Default: 100%
1.0.0

4 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.1

6 years ago