@
hu8245 @
wanacry 代码如下,应该在什么位置调整呢?
(function (addSourceBuffer) {
MediaSource.prototype.addSourceBuffer = function (mime) {
console.log(mime)
switch (mime.substr(0, 5)){
case "audio":
window.ams = addSourceBuffer.call(this, mime);
return window.ams
window.audioBuffer = [];
break;
case "video":
window.vms = addSourceBuffer.call(this, mime);
return window.vms
window.videoBuffer = [];
break;
default:
return addSourceBuffer.call(this, mime);
}
};
})(MediaSource.prototype.addSourceBuffer);
window.videoBuffer = [];
window.audioBuffer = [];
(function (appendBuffer) {
SourceBuffer.prototype.appendBuffer = function (source) {
if(this == window.ams){
console.log("audio buffer get")
window.audioBuffer[window.audioBuffer.length] = source
}
if(this == window.vms){
console.log("video buffer get")
window.videoBuffer[window.videoBuffer.length] = source
}
appendBuffer.call(this, source);
};
})(SourceBuffer.prototype.appendBuffer);