media

HTML5 Media Player

npm install media
2 downloads in the last day
9 downloads in the last week
86 downloads in the last month

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

See complete reference

npm loves you