media

HTML5 Media Player

Lightweight Wrapper For HTML5 Media API

media = require('media')
 
media.audio('song.mp3').autoplay()
media.video('totoro.mp4').autoplay()
$ npm install media
media.audio(['song.mp3', 'song.ogg']).autoplay()
parent = document.querySelector('.my-player')
media.audio(['song.mp3', 'song.ogg'], parent).autoplay.controls()

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)
  • abort
  • durationchange
  • ended
  • error
  • pause
  • play
  • progress
  • timeupdate

See complete reference