Skip to content

Tinyplayer

İlker Göktuğ Öztürk edited this page Apr 26, 2016 · 4 revisions

Tinyplayer is an HTML5 video player with XHR & Media Source Extension capabilities. It also automatically recognizes Gust on page if loaded since it has native support.

API

Tinyplayer(video: HTMLVideoElement, options?: Options)

Options

beforeRequest: function(options: XhrOptions): XhrOptions

You can modify xhr requests by beforeRequest. See fields of XhrOptions.

var video = document.getElementById("video");
Tinyplayer(video, {
  beforeRequest: function(options) {
    options.withCredentials = true;
    return options;
  }
});

How to use

The only difference from standard HTML5 video initialization pattern is you also need to specify codec information within type prop and use application keyword instead video for video format e.g application/mp4 and initialize your video with Tinyplayer.

<video
  id="video"
  autoplay>
   <source
    src="frag_bunny.mp4"
    type='application/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
</video>
<script>
var video = document.getElementById("video");
Tinyplayer(video);
</script>