@@ -143,8 +143,16 @@ const player = Player.make<Ctx>('#player', {
143143 // source: DANMAKU //SUPER_DANMAKU
144144 } ) ,
145145 new Playlist ( {
146- initialIndex : 3 ,
146+ initialIndex : 0 ,
147147 sources : [
148+ {
149+ title : 'DASH DRM' ,
150+ id : 'dash-drm'
151+ } ,
152+ {
153+ title : 'Hls DRM' ,
154+ id : 'hls-drm'
155+ } ,
148156 {
149157 title : 'hls - muti quality & subtitle & audio' ,
150158 src : 'https://storage.googleapis.com/shaka-demo-assets/angel-one-hls/hls.m3u8'
@@ -197,12 +205,6 @@ const player = Player.make<Ctx>('#player', {
197205 ] ,
198206 highlights : highlight
199207 } ,
200- {
201- title : 'BROKEN SOURCE & POSTER' ,
202- src : '//' ,
203- poster : '//' ,
204- duration : '00:00'
205- } ,
206208 {
207209 title : "Disney's Oceans - MP4" ,
208210 src : 'https://vjs.zencdn.net/v/oceans.mp4' ,
@@ -232,7 +234,45 @@ const player = Player.make<Ctx>('#player', {
232234 // 'magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel.torrent',
233235 poster : 'https://api.imlazy.ink/img?webtorrent'
234236 }
235- ]
237+ ] ,
238+ customFetcher ( player , source ) {
239+ if ( source . id === 'dash-drm' ) {
240+ ; ( player . context . dash as ReturnType < typeof dash > ) . options . drm = {
241+ 'com.widevine.alpha' : {
242+ serverURL : 'https://drm-widevine-licensing.axtest.net/AcquireLicense' ,
243+ httpRequestHeaders : {
244+ 'X-AxDRM-Message' :
245+ 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V5X2lkIjoiYjMzNjRlYjUtNTFmNi00YWUzLThjOTgtMzNjZWQ1ZTMxYzc4IiwibWVzc2FnZSI6eyJ0eXBlIjoiZW50aXRsZW1lbnRfbWVzc2FnZSIsImtleXMiOlt7ImlkIjoiOWViNDA1MGQtZTQ0Yi00ODAyLTkzMmUtMjdkNzUwODNlMjY2IiwiZW5jcnlwdGVkX2tleSI6ImxLM09qSExZVzI0Y3Iya3RSNzRmbnc9PSJ9XX19.4lWwW46k-oWcah8oN18LPj5OLS5ZU-_AQv7fe0JhNjA'
246+ } ,
247+ priority : 0
248+ }
249+ }
250+ return {
251+ ...source ,
252+ src : 'https://media.axprod.net/TestVectors/v7-MultiDRM-SingleKey/Manifest_1080p.mpd'
253+ }
254+ } else if ( source . id == 'hls-drm' ) {
255+ ; ( player . context . hls as ReturnType < typeof hls > ) . options . config = {
256+ ...player . context . hls . options . config ,
257+ emeEnabled : true ,
258+ drmSystems : {
259+ 'com.widevine.alpha' : {
260+ licenseUrl : 'https://widevine-proxy.appspot.com/proxy'
261+ }
262+ } ,
263+ licenseXhrSetup ( xhr ) {
264+ xhr . setRequestHeader ( 'content-type' , 'application/octet-stream' )
265+ xhr . setRequestHeader ( 'Authorization' , 'Bearer token' ) // or other headers
266+ }
267+ }
268+
269+ return { } //TODO
270+ } else {
271+ ; ( player . context . dash as ReturnType < typeof dash > ) . options . drm = null
272+ ; ( player . context . hls as ReturnType < typeof hls > ) . options . config . emeEnabled = false
273+ }
274+ return source
275+ }
236276 // m3uList: {
237277 // sourceFormat(info) {
238278 // const chunk = info.title.substring(3).split(' ')
@@ -257,8 +297,6 @@ function stopLoad() {
257297 player . $video . src = URL . createObjectURL ( new Blob ( [ u8 . buffer ] ) )
258298}
259299
260- let src : string = player . context . playlist . options . sources [ initialIndex ] . src
261-
262300render (
263301 html `
264302 < div >
0 commit comments