1
メディアソースを使用してライブMPEG-DASHを再生するための独自のコードを作成しようとしていますが、データの取得に成功しましたが、プレーヤーでは表示できません。ライブコードと一緒に住んではなく、されていないソースを使用した場合自分のライブダッシュプレーヤーを作成
function GETData(){
\t var xhr = new XMLHttpRequest(); \t \t \t
\t xhr.onreadystatechange = function() \t {
\t \t if(xhr.readyState == 4 && xhr.status == 200){
\t \t \t liveIndex++;
\t \t \t receiveBuffer.push(xhr.response);
\t \t \t if(audio == false){
\t \t \t \t appendVideo();
\t \t \t \t audio = true;
\t \t \t } \t \t \t \t \t \t
\t \t \t else{
\t \t \t \t appendAudio();
\t \t \t \t audio = false;
\t \t \t } \t \t \t
\t \t }
\t }; \t \t
\t xhr.open("GET", urlList[liveIndex], true);
\t xhr.responseType = 'arraybuffer'; \t \t
\t xhr.send();
}
function updateVideoFunc(){ \t
\t sbVideo.removeEventListener("update", updateVideoFunc);
\t GETData(); \t \t
}
function updateAudioFunc(){ \t
\t sbAudio.removeEventListener("update", updateAudioFunc);
\t GETData(); \t \t
}
function sourceopen(e){ \t
\t sourceBuffer = this.sourceBuffers;
\t sourceBuffer[trackName] = ms.addSourceBuffer('video/mp4;codecs=avc1.42c01e');
\t sbVideo =sourceBuffer[trackName];
sbVideo.addEventListener('updateend', updateVideoFunc);
\t
\t sourceBuffer = this.sourceBuffers;
\t sourceBuffer[trackName2] = ms.addSourceBuffer('audio/mp4;codecs="mp4a.40.2');
\t sbAudio =sourceBuffer[trackName2];
sbAudio.addEventListener('updateend', updateAudioFunc);
\t GETData();
}
var fileIndex = 0;
function appendVideo()
\t if(sbVideo.updating == false)
\t {
\t \t
\t \t sbVideo.appendBuffer(new Uint8Array(receiveBuffer[fileIndex]));
\t \t sbVideo.addEventListener("updateend",updateVideoFunc, false); \t \t \t \t \t
\t \t fileIndex++;
\t }
}
function appendAudio(){
\t if(sbAudio.updating == false && sbVideo.updating == false){
\t \t
\t \t sbAudio.appendBuffer(new Uint8Array(receiveBuffer[fileIndex]));
\t \t sbAudio.addEventListener("updateend",updateAudioFunc, false); \t \t \t \t \t
\t \t fileIndex++;
\t }
}
このコードが働きました。 私は行方不明ですか?