More Related Content Similar to リニア放送型動画サービスの
Web フロントエンド (20) More from Yusuke Goto (20) リニア放送型動画サービスの
Web フロントエンド41. 💻
const xhr = new XMLHttpRequest();
xhr.open("GET", “1-00.ts", true);
…
xhr.send(null);
42. 💻
const xhr = new XMLHttpRequest();
xhr.open("GET", “1-01.ts", true);
…
xhr.send(null);
53. 💻
const xhr =
new XMLHttpRequest();
xhr.open(
"GET",
"playlist.m3u8",
true
);
…
xhr.send(null);
57. #EXTM3U
#EXT-X-TARGETDURATION:10
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:10,
segment1.ts
#EXTINF:10,
segment2.ts
#EXTINF:10,
segment3.ts
#EXTINF:10,
segment4.ts
#EXTINF:10,
segment5.ts
💻
#EXTM3U
#EXT-X-TARGETDURATION:10
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:2
#EXTINF:10,
segment2.ts
#EXTINF:10,
segment3.ts
#EXTINF:10,
segment4.ts
#EXTINF:10,
segment5.ts
#EXTINF:10,
segment6.ts
58. #EXTM3U
#EXT-X-TARGETDURATION:10
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:10,
segment1.ts
#EXTINF:10,
segment2.ts
#EXTINF:10,
segment3.ts
#EXTINF:10,
segment4.ts
#EXTINF:10,
segment5.ts
💻
#EXTM3U
#EXT-X-TARGETDURATION:10
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:2
#EXTINF:10,
segment2.ts
#EXTINF:10,
segment3.ts
#EXTINF:10,
segment4.ts
#EXTINF:10,
segment5.ts
#EXTINF:10,
segment6.ts
77. <video id="video"></video>
var sourceBuffer;
const video = document.getElementById("video");
const mediaSource = new MediaSource();
const type = 'video/mp4; codecs="avc1.4d401f, mp4a.40.2"';
mediaSource.addEventListener("sourceopen", () => {
sourceBuffer = mediaSource.addSourceBuffer(type);
}, false);
video.src = URL.createObjectURL(mediaSource);
78. const xhr = new XMLHttpRequest();
xhr.open("GET", "playlist.m3u8", true);
…
xhr.send(null);
📄
☁HTTP
💻
Playlist
m3u8
95. AAC or MP3 ?
https://www.winxdvd.com/resource/aac-vs-mp3.htm
110. Video Packet Audio Packet Video Packet Audio PacketMeta Packet
// hls.js
hls.player.on(
Hls.Events.FRAG_PARSING_METADATA,
(event, data) => {
console.log(data.samples); // as Uint8Array
};
);
121. RTMP
CM signal
📹
https://abema.tv/
👤
📄📄📄📄
☁HTTP
Encoder Media Server
function onChangeNCStatus() {
const code: String = e.info.code;
if (code === "NetConnection.Connect.Success") {
nc.call("insertCM");
// CM
}
}
var nc = new NetConnection();
nc.addEventListener(
NetStatusEvent.NET_STATUS,
onChangeNCStatus
);