Last active
July 13, 2020 08:51
-
-
Save andreupifarre/1d75f9f5b5edeb8e36c995339b4f2854 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const preload = Preload(); | |
preload.fetch([ | |
'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerEscapes.mp4', | |
'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4', | |
'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4' | |
]).then(result => { | |
// use either a promise or 'oncomplete' | |
}); | |
preload.oncomplete = items => { | |
player.src = preload.getItemByUrl('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4').blobUrl; | |
player.play(); | |
} | |
preload.onprogress = event => { | |
document.getElementById('progress').textContent = document.getElementById('progress-bar').style.width = event.progress + '%'; | |
} | |
preload.onfetched = item => { | |
document.getElementById('loaded-items').innerHTML += '<span>' + item.fileName + ' <strong>[' + item.size + ']</strong></span>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment