Package Exports
- media
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (media) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
media
Lightweight Wrapper For HTML5 Media API
media = require('media')
media.audio('song.mp3').autoplay()
media.video('totoro.mp4').autoplay()
Install
$ npm install media
Browser Compatibility
media.audio(['song.mp3', 'song.ogg']).autoplay()
Displaying Controls
parent = document.querySelector('.my-player')
media.audio(['song.mp3', 'song.ogg'], parent).autoplay.controls()
API
Example:
media.audio('foo.mp3').volume(0.3).controls().loop().on('ended', function(){
console.log('End of the song reached')
})
Reference:
- media(type, uri, parentElement)
- .controls
- .currentTime
- .element
- .loop
- .muted
- .on(event, function)
- .pause
- .play
- .preload
- .src(url)
- .volume(number)
Events
- abort
- durationchange
- ended
- error
- pause
- play
- progress
- timeupdate