0.1.2 • Published 2 years ago

@creaditor/media-player-web-component v0.1.2

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Creaditor Media Player

Keep the following in mind

this package use react-player

Installation

Node package

npm i styleit-api --save

Include the module in your application

import "@creaditor/media-player-web-component"

Add the tag in as dom element

<cdtr-media-player></cdtr-media-player>

Publish

Please build using npm run build

and then run npm publish

Props

PropDescriptionDefault
urlThe url of a video or song to play  Can be an array or MediaStream object
playingSet to true or false to pause or play the mediafalse
loopSet to true or false to loop the mediafalse
controlsSet to true or false to display native player controls.  For Vimeo videos, hiding controls must be enabled by the video owner.false
lightSet to true to show just the video thumbnail, which loads the full player on click  Pass in an image URL to override the preview imagefalse
volumeSet the volume of the player, between 0 and 1  null uses default volume on all players #357null
mutedMutes the player  Only works if volume is setfalse
playbackRateSet the playback rate of the player  Only supported by YouTube, Wistia, and file paths1
widthSet the width of the player640px
heightSet the height of the player360px
styleAdd inline styles to the root element{}
progressIntervalThe time between onProgress callbacks, in milliseconds1000
playsinlineApplies the playsinline attribute where supportedfalse
pipSet to true or false to enable or disable picture-in-picture mode  Only available when playing file URLs in certain browsersfalse
stopOnUnmountIf you are using pip you may want to use stopOnUnmount={false} to continue playing in picture-in-picture mode even after ReactPlayer unmountstrue
fallbackElement or component to use as a fallback if you are using lazy loadingnull
wrapperElement or component to use as the container elementdiv
playIconElement or component to use as the play icon in light mode
previewTabIndexSet the tab index to be used on light mode0
configOverride options for the various players, see config prop

Callback props

Callback props take a function that gets fired on various player events:

PropDescription
onReadyCalled when media is loaded and ready to play. If playing is set to true, media will play immediately
onStartCalled when media starts playing
onPlayCalled when media starts or resumes playing after pausing or buffering
onProgressCallback containing played and loaded progress as a fraction, and playedSeconds and loadedSeconds in seconds  eg { played: 0.12, playedSeconds: 11.3, loaded: 0.34, loadedSeconds: 16.7 }
onDurationCallback containing duration of the media, in seconds
onPauseCalled when media is paused
onBufferCalled when media starts buffering
onBufferEndCalled when media has finished buffering  Works for files, YouTube and Facebook
onSeekCalled when media seeks with seconds parameter
onPlaybackRateChangeCalled when playback rate of the player changed  Only supported by YouTube, Wistia, and file paths
onEndedCalled when media finishes playing  Does not fire when loop is set to true
onErrorCalled when an error occurs whilst attempting to play media
onClickPreviewCalled when user clicks the light mode preview
onEnablePIPCalled when picture-in-picture mode is enabled
onDisablePIPCalled when picture-in-picture mode is disabled