Skip to content

Commit

Permalink
fix fetch自定义headerbug
Browse files Browse the repository at this point in the history
  • Loading branch information
bosscheng committed Aug 15, 2023
1 parent bb96e7c commit 8a95480
Show file tree
Hide file tree
Showing 11 changed files with 130 additions and 30 deletions.
37 changes: 37 additions & 0 deletions demo/document.md
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,43 @@ windows 系统压缩方法
<img src="/public/wasm.png">


#### nginx的配置

1. 用的springboot的tomcat,所以修改tomcat的mime类型,多添加一个wasm的类型
2. 用的是ISS,配置下wasm类型的数据就行了。

Extension: .wasm (dot wasm)
MIMEType: application/wasm

##### apache修改 mime.types,添加

```shell
application/wasm wasm

```

##### nginx修改mime.types,添加

```shell
application/wasm wasm;

```
##### 或者 nginx修改nginx.conf,添加

```shell
{
# 配置 MIME 类型
types {
application/wasm wasm;
}

# 开启 gzip 压缩
gzip on;

}
```


#### 通过springBoot 部署的静态资源遇到 `falling back to arraybuffer instantiation` 错误问题

> decoder-pro-simd.js:1 wasm streaming compile failed: CompileError: WebAssembly.instantiateStreaming(): section (code 1, "Type") extends past end of the module (length 11493359, remaining bytes 2877270) @+8
Expand Down
2 changes: 1 addition & 1 deletion demo/public/decoder.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/public/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
<input
autocomplete="on"
id="playUrl"
value="http://flv.bdplay.nodemedia.cn/live/bbb_264.flv"
value="https://live.nodemedia.cn:8443/live/b480_264.flv"
/>
<button id="play">播放</button>
<button id="pause" style="display: none">停止</button>
Expand Down
Binary file modified demo/public/dist.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions demo/public/jessibuca.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,9 @@ declare class Jessibuca {
buf: number;
/** 当前视频帧率 */
fps: number;
/** 当前音频码率,单位bit */
/** 当前音频码率,单位byte */
abps: number;
/** 当前视频码率,单位bit */
/** 当前视频码率,单位byte */
vbps: number;
/** 当前视频帧pts,单位毫秒 */
ts: number;
Expand Down
90 changes: 76 additions & 14 deletions demo/public/jessibuca.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion demo/public/jessibuca.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/jessibuca.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,9 @@ declare class Jessibuca {
buf: number;
/** 当前视频帧率 */
fps: number;
/** 当前音频码率,单位bit */
/** 当前音频码率,单位byte */
abps: number;
/** 当前视频码率,单位bit */
/** 当前视频码率,单位byte */
vbps: number;
/** 当前视频帧pts,单位毫秒 */
ts: number;
Expand Down
2 changes: 1 addition & 1 deletion dist/jessibuca.js

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions src/jessibuca.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ class Jessibuca extends Emitter {
this.pause().then(() => {
this.player.debug.log('Jessibuca', 'webglAlignmentError')
this._resetPlayer({openWebglAlignment: true})
this.play(url).then(() => {
this.play(url,options).then(() => {
// resolve();
this.player.debug.log('Jessibuca', 'webglAlignmentError and play success')
}).catch(() => {
Expand Down Expand Up @@ -358,7 +358,7 @@ class Jessibuca extends Emitter {
this.pause().then(() => {
this.player.debug.log('Jessibuca', 'media source full');
this._resetPlayer()
this.play(url).then(() => {
this.play(url,options).then(() => {
// resolve();
this.player.debug.log('Jessibuca', 'media source full and reset player and play success')
}).catch(() => {
Expand All @@ -372,7 +372,7 @@ class Jessibuca extends Emitter {
this.pause().then(() => {
this.player.debug.log('Jessibuca', 'media source append buffer error');
this._resetPlayer()
this.play(url).then(() => {
this.play(url,options).then(() => {
// resolve();
this.player.debug.log('Jessibuca', 'media source append buffer error and reset player and play success')
}).catch(() => {
Expand All @@ -386,7 +386,7 @@ class Jessibuca extends Emitter {
this.pause().then(() => {
this.player.debug.log('Jessibuca', 'media source buffer list large');
this._resetPlayer()
this.play(url).then(() => {
this.play(url,options).then(() => {
// resolve();
this.player.debug.log('Jessibuca', 'media source buffer list large and reset player and play success')
}).catch(() => {
Expand All @@ -400,7 +400,7 @@ class Jessibuca extends Emitter {
this.pause().then(() => {
this.player.debug.log('Jessibuca', 'media source append buffer end timeout');
this._resetPlayer()
this.play(url).then(() => {
this.play(url,options).then(() => {
// resolve();
this.player.debug.log('Jessibuca', 'media source append buffer end timeout and reset player and play success')
}).catch(() => {
Expand All @@ -422,7 +422,7 @@ class Jessibuca extends Emitter {
if (this.player._opt.autoWasm) {
this.player.debug.log('Jessibuca', 'auto wasm [wcs-> wasm] reset player and play')
this._resetPlayer({useWCS: false})
this.play(url).then(() => {
this.play(url,options).then(() => {
// resolve();
this.player.debug.log('Jessibuca', 'auto wasm [wcs-> wasm] reset player and play success')
}).catch(() => {
Expand All @@ -437,7 +437,7 @@ class Jessibuca extends Emitter {
this.pause().then(() => {
this.player.debug.log('Jessibuca', 'webcodecs Width Or Height Change reset player and play')
this._resetPlayer({useWCS: true})
this.play(url).then(() => {
this.play(url,options).then(() => {
// resolve();
this.player.debug.log('Jessibuca', 'webcodecs Width Or Height Change reset player and play success')
}).catch(() => {
Expand All @@ -452,7 +452,7 @@ class Jessibuca extends Emitter {
if (this.player._opt.autoWasm) {
this.player.debug.log('Jessibuca', 'webcodecs decode error reset player and play')
this._resetPlayer({useWCS: false})
this.play(url).then(() => {
this.play(url,options).then(() => {
// resolve();
this.player.debug.log('Jessibuca', 'webcodecs decode error reset player and play success')
}).catch(() => {
Expand Down
1 change: 1 addition & 0 deletions src/stream/fetchLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default class FetchLoader extends Emitter {
*/
fetchStream(url, options = {}) {
const {demux} = this.player;
this.player.debug.log('FetchStream', 'fetchStream', url, JSON.stringify(options));
this.player._times.streamStart = now();
const fetchOptions = Object.assign({
signal: this.abortController.signal,
Expand Down

1 comment on commit 8a95480

@vercel
Copy link

@vercel vercel bot commented on 8a95480 Aug 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.