|
26 | 26 | <span class=label> |
27 | 27 | encoding |
28 | 28 | </span> |
29 | | - <span id=encoding></span> |
| 29 | + <span id=content-encoding></span> |
30 | 30 | </div> |
31 | 31 | <div> |
32 | 32 | <span class=label> |
|
65 | 65 | var $ = (root,sel)=>(!sel && (sel=root,root=document),root.querySelector(sel)); |
66 | 66 |
|
67 | 67 |
|
68 | | - //varr url = 'https://raw.githubusercontent.com/javascript-2020/external/main/ffmpeg/ffmpeg-wasm/ffmpeg-wasm.zip' |
69 | | - var url = 'https://cdn.jsdelivr.net/gh/javascript-2020/libs/js/io/tiny-unzip/tiny-unzip.m.js'; |
| 68 | + var url = 'https://raw.githubusercontent.com/javascript-2020/external/main/ffmpeg/ffmpeg-wasm/ffmpeg-wasm.zip' |
| 69 | + // var url = 'https://bgrins.github.io/videoconverter.js/build/ffmpeg-all-codecs.js'; |
70 | 70 |
|
71 | 71 | var i = url.lastIndexOf('/')+1 |
72 | 72 | var fn = url.slice(i); |
|
77 | 77 |
|
78 | 78 | var res = await fetch(url,{headers,method,body}); |
79 | 79 |
|
80 | | - var encoding = res.headers.get('content-encoding')?.toLowerCase(); |
81 | | - if(encoding && encoding!=='identity'){ |
82 | | - encoding = false; |
| 80 | + var encoding = res.headers.get('content-encoding'); |
| 81 | + console.log('content-encoding',encoding); |
| 82 | + $('#content-encoding').textContent = encoding; |
| 83 | + |
| 84 | + var flag = false; |
| 85 | + if(encoding){ |
| 86 | + encoding = encoding.toLowerCase(); |
| 87 | + if(encoding==='identity'){ |
| 88 | + flag = true; |
| 89 | + } |
| 90 | + } |
| 91 | + encoding = flag; |
| 92 | + if(!encoding){ |
83 | 93 | $('#bar').className = 'unknown'; |
84 | 94 | $('#bar').style.width = '100%'; |
85 | 95 | console.log('unable to reliably computer content-length'); |
86 | | - }else{ |
87 | | - encoding = true; |
88 | 96 | } |
89 | 97 |
|
90 | 98 | var type = res.headers.get('content-type'); |
91 | 99 | $('#content-type').textContent = type; |
92 | 100 |
|
93 | 101 | var len = res.headers.get('content-length'); |
| 102 | + $('#content-length').textContent = len; |
94 | 103 | console.log(len); |
95 | 104 | var total = 0; |
96 | 105 | var reader = res.body.getReader(); |
|
0 commit comments