Created
July 21, 2015 01:28
-
-
Save MeoMix/be5485584baf2a5c016d 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
} else if (responseType === 'arraybuffer') { | |
// The itag is a unique identifier which provides a 1:1 between videoInfo and a video data response. | |
var itag = (responseURL.split('itag=')[1] || '').split('&')[0]; | |
// There's no guarantee that the current request is a video data response. | |
if (itag !== '') { | |
var videoInfo = videoInfoList.filter(function(object) { | |
return object.itag === itag; | |
})[0]; | |
if (videoInfo) { | |
// Notify background of video information data necessary to render the video on another page. | |
// The type of video (including codec) as well as the ArrayBuffer of video data. | |
var message = { | |
buffer: this.response.slice(0), | |
bufferType: videoInfo.type | |
}; | |
// Be sure to mark the buffer as transferable as it can be a large amount of data. | |
window.top.postMessage(message, origin, [message.buffer]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment