A simple HTML5 media player with custom controls and WebVTT captions.
Plyr: Specify the id prefix for the icons used in the default controls (e.g. 'plyr-play' would be 'plyr'). This is to prevent clashes if you're using your own SVG sprite but with the default controls. Most people can ignore this option. Debug: Boolean: false: Display debugging information on what Plyr is doing. Autoplay: Boolean: false. Dynamic NPM dependency loading in Liferay. This is an example of a npm dependency module which in Liferay we call a provider. It is useful because you can dynamically add npm dependencies to your Liferay as OSGI modules and then call them asynchronously.
PlyrDriver: see custom plyr driver; Important: changing plyrOptions, plyrPlaysInline and plyrCrossOrigin will trigger the Plyr reinitialization, since these options cannot be changed on-the-fly. Ngx-plyr events: plyrInit: emits a plyr instance when it gets created; plyr. A vue component for the plyr video & audio player. I just update the version of plyr - 6.0.5 - a JavaScript package on npm - Libraries.io.
A React video component based on Plyr.
Installation
Fast motion clipper 1 0 download free. Add
react-plyr
into your package.json dependencies:CSS
Include the
plyr.css
stylsheet into your <head>
If you want to use our CDN (provided by Fastly) for the default CSS, you can use the following:
Usage
Simple Youtube or Vimeo video
Note: The
videoId
can either be the video ID or URL for the media.Props
Prop | Default | |
---|---|---|
enable | Disable | true |
title | Custom media title | ' |
debug | Logging to console | false |
autoplay | Auto play (if supported) | false |
autopause | Only allow one media playing at once (vimeo only) | true |
seekTime | Default time to skip when rewind/fast forward | 10 |
volume | Default volume | 1 |
muted | Default volume (0) | false |
duration | Pass a custom duration | null |
displayDuration | Display the media duration on load in the current time position If you have opted to display both duration and currentTime, this is ignored | true |
invertTime | Invert the current time to be a countdown | true |
toggleInvert | Clicking the currentTime inverts it's value to show time left rather than elapsed | true |
ratio | Aspect ratio (for embeds) | '16:9' |
clickToPlay | Click video container to play/pause | true |
hideControls | Auto hide the controls | true |
resetOnEnd | Reset to start when playback ended | false |
disableContextMenu | Disable the standard context menu | true |
loadSprite | Sprite (for icons) | true |
iconPrefix | Sprite (for icons) | 'plyr' |
iconUrl | Sprite (for icons) | 'https://cdn.plyr.io/3.3.5/plyr.svg' |
blankVideo | Blank video (used to prevent errors on source change) | 'https://cdn.plyr.io/static/blank.mp4' |
quality | Quality default | { default: 576, options: [ 4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240, 'default' ] } |
loop | Set loops | { loop: { active: false } } |
speed | Speed default and options to display | { selected: 1, options: [ 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ] } |
keyboard | Keyboard shortcut settings | { focused: true, global: false } |
tooltips | Display tooltips | { controls: false, seek: true } |
captions | Captions settings | { active: false, language: 'auto', update: false } |
fullscreen | Fullscreen settings | { enabled: true, fallback: true, iosNative: false } |
storage | Local storage | { enabled: true, key: 'plyr' } |
controls | Default controls | [ 'play-large', 'play', 'progress', 'current-time', 'mute', 'volume', 'captions', 'settings', 'pip', 'airplay', 'fullscreen' ] |
settings | [ 'captions', 'quality', 'speed' ] | |
i18n | Localisation | { restart: 'Restart', rewind: 'Rewind {seektime} secs', play: 'Play', pause: 'Pause', fastForward: 'Forward {seektime} secs', seek: 'Seek', played: 'Played', buffered: 'Buffered', currentTime: 'Current time', duration: 'Duration', volume: 'Volume', mute: 'Mute', unmute: 'Unmute', enableCaptions: 'Enable captions', disableCaptions: 'Disable captions', enterFullscreen: 'Enter fullscreen', exitFullscreen: 'Exit fullscreen', frameTitle: 'Player for {title}', captions: 'Captions', settings: 'Settings', speed: 'Speed', normal: 'Normal', quality: 'Quality', loop: 'Loop', start: 'Start', end: 'End', all: 'All', reset: 'Reset', disabled: 'Disabled', enabled: 'Enabled', advertisement: 'Ad' } |
urls | URLs | { vimeo: { sdk: 'https://player.vimeo.com/api/player.js', iframe: 'https://player.vimeo.com/video/{0}?{1}', api: 'https://vimeo.com/api/v2/video/{0}.json' }, youtube: { sdk: 'https://www.youtube.com/iframe_api', api: 'https://www.googleapis.com/youtube/v3/videos?id={0}&key={1}&fields=items(snippet(title))&part=snippet', poster: 'https://img.youtube.com/vi/{0}/maxresdefault.jpg,https://img.youtube.com/vi/{0}/hqdefault.jpg' }, googleIMA: { sdk: 'https://imasdk.googleapis.com/js/sdkloader/ima3.js' } } |
keys | API keys | { google: null } |
ads | Advertisements plugin Register for an account here: http://vi.ai/publisher-video-monetization/ | { enabled: false, publisherId: ', tagUrl: ' } |
tracks | [] |
Support
Please open an issue for support.
Contributing
Please contribute using Github Flow. Create a branch, add commits, and open a pull request.
index.html
<scriptsrc='https://cdn.jsdelivr.net/npm/hls.js'></script> |
<scriptsrc='https://unpkg.com/plyr@3'></script> |
<scriptsrc='./script.js'></script> |
<divclass='container'> |
Try adjust different video quality to see it yourself |
<videocontrolscrossoriginplaysinline> |
<source |
type='application/x-mpegURL' |
src='https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8' |
> |
</video> |
</div> |
qbzjvgw.markdown
Plyr Npm Command
script.js
document.addEventListener('DOMContentLoaded',()=>{ |
constvideo=document.querySelector('video'); |
constsource=video.getElementsByTagName('source')[0].src; |
// For more options see: https://github.com/sampotts/plyr/#options |
// captions.update is required for captions to work with hls.js |
constdefaultOptions={}; |
if(Hls.isSupported()){ |
// For more Hls.js options, see https://github.com/dailymotion/hls.js |
consthls=newHls(); |
hls.loadSource(source); |
// From the m3u8 playlist, hls parses the manifest and returns |
// all available video qualities. This is important, in this approach, |
// we will have one source on the Plyr player. |
hls.on(Hls.Events.MANIFEST_PARSED,function(event,data){ |
// Transform available levels into an array of integers (height values). |
constavailableQualities=hls.levels.map((l)=>l.height) |
// Add new qualities to option |
defaultOptions.quality={ |
default: availableQualities[0], |
options: availableQualities, |
// this ensures Plyr to use Hls to update quality level |
forced: true, |
onChange: (e)=>updateQuality(e), |
} |
// Initialize here |
constplayer=newPlyr(video,defaultOptions); |
}); |
hls.attachMedia(video); |
window.hls=hls; |
}else{ |
// default options with no quality update in case Hls is not supported |
constplayer=newPlyr(video,defaultOptions); |
} |
functionupdateQuality(newQuality){ |
console.log(newQuality); |
window.hls.levels.forEach((level,levelIndex)=>{ |
if(level.heightnewQuality){ |
console.log('Found quality match with '+newQuality); |
window.hls.currentLevel=levelIndex; |
} |
}); |
} |
}); |
style.css
Plyr Npm React
.container { |
padding-top: 18vh; |
margin: 20px auto; |
width: 600px; |
} |
video { |
width: 100%; |
} |
Player Npm
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment