Skip to content

Instantly share code, notes, and snippets.

View ivatsa's full-sized avatar

Srivatsa ivatsa

  • Akamai Technologies
  • Burlingame
View GitHub Profile
@ivatsa
ivatsa / CustomHlsPlayer.js
Created May 23, 2017 23:36
This is an extension to hls.js to skip segments which are not available like on 404 response. However this a reactive method, meaning only after playback is stuck this logic kicks-in and keeps hoping segments until a playable segment is reached.
/*
* Description:
* This player skips segments on network/Media error but switches to next playable segment only on playback stall.
*
* Usage Example:
* <script src="https://cdn.jsdelivr.net/hls.js/latest/hls.min.js"></script>
* <script src="js/customHls.js"></script>
* <video id="customHlsvideo"></video>
* <script>
* var videoElement = document.getElementById('customHlsvideo');
hls.js:12005 [log] > attachMedia
hls.js:12005 [log] > loadSource:https://moctobp1-i.akamaihd.net/hls/live/483058/parkour2/index.m3u8?type=MAE
hls.js:12005 [log] > trigger BUFFER_RESET
hls.js:12005 [log] > media source opened
hls.js:12005 [log] > manifest loaded,4 level(s) found, first bitrate:2274788
hls.js:12005 [log] > 2 sourceBuffer(s) expected
hls.js:12005 [log] > startLoad
hls.js:12005 [log] > engine state transition from undefined to STOPPED
hls.js:12005 [log] > demuxing in webworker
hls.js:12005 [log] > engine state transition from STOPPED to STARTING