Skip to content

Commit 7b2a45b

Browse files
committed
fix kbps error bug
1 parent 2e90de1 commit 7b2a45b

28 files changed

+233
-88
lines changed

demo/api.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,17 @@ jessibuca.toggleControlBar()
778778
const isShow = jessibuca.getControlBarShow()
779779
```
780780

781+
### kbpsToSpeed(kbps)
782+
- **用法**: 码率转换成网速 kbps -> KB/s
783+
- **返回**`{number}`
784+
785+
```js
786+
jessibuca.on("kBps", function (data) {
787+
console.log('kBps:', data)
788+
// 如果想要转换成网速
789+
const speed = jessibuca.kbpsToSpeed(data);
790+
})
791+
```
781792

782793
### on(event, callback)
783794

@@ -909,12 +920,18 @@ jessibuca.on("error", function (error) {
909920

910921
### kBps
911922

912-
当前网速, 单位KB 每秒1次,
923+
当前码率, 每秒1次,
924+
925+
> 码率是和网速是区分的,网速是指当前网络的下载速度,码率是指当前视频的码率。
926+
927+
> 1 Bps = 8 bps
913928

914929
```js
915930
916931
jessibuca.on("kBps", function (data) {
917932
console.log('kBps:', data)
933+
// 如果想要转换成网速
934+
const speed = jessibuca.kbpsToSpeed(data);
918935
})
919936
```
920937

demo/public/decoder.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/public/dist.zip

1.01 KB
Binary file not shown.

demo/public/jessibuca.d.ts

Lines changed: 72 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,32 @@ declare namespace Jessibuca {
171171
* https://github.com/langhuihui/jessibuca/issues/152 解决方案
172172
* 例如:WebGL图像预处理默认每次取4字节的数据,但是540x960分辨率下的U、V分量宽度是540/2=270不能被4整除,导致绿屏。
173173
*/
174-
openWebglAlignment?: boolean
174+
openWebglAlignment?: boolean,
175+
176+
/**
177+
* webcodecs硬解码是否通过video标签渲染
178+
*/
179+
wcsUseVideoRender?: boolean,
180+
181+
/**
182+
* 底部控制台是否自动隐藏
183+
*/
184+
controlAutoHide?: boolean,
185+
186+
/**
187+
* 录制的视频格式
188+
*/
189+
recordType?: 'webm' | 'mp4',
190+
191+
/**
192+
* 是否使用web全屏(旋转90度)(只会在移动端生效)。
193+
*/
194+
useWebFullScreen?: boolean,
195+
196+
/**
197+
* 是否自动使用系统全屏
198+
*/
199+
autoUseSystemFullScreen?: boolean,
175200
}
176201
}
177202

@@ -222,8 +247,8 @@ declare class Jessibuca {
222247
jessibuca.setTimeout(10)
223248
224249
jessibuca.on('timeout',function(){
225-
//
226-
});
250+
//
251+
});
227252
*/
228253
setTimeout(): void;
229254

@@ -249,17 +274,17 @@ declare class Jessibuca {
249274
* 可以在pause 之后,再调用 `play()`方法就继续播放之前的流。
250275
@example
251276
jessibuca.pause().then(()=>{
252-
console.log('pause success')
277+
console.log('pause success')
253278
254-
jessibuca.play().then(()=>{
279+
jessibuca.play().then(()=>{
255280
256-
}).catch((e)=>{
281+
}).catch((e)=>{
257282
258-
})
283+
})
259284
260-
}).catch((e)=>{
261-
console.log('pause error',e);
262-
})
285+
}).catch((e)=>{
286+
console.log('pause error',e);
287+
})
263288
*/
264289
pause(): Promise<void>;
265290

@@ -289,14 +314,20 @@ declare class Jessibuca {
289314
@example
290315
291316
jessibuca.play('url').then(()=>{
292-
console.log('play success')
293-
}).catch((e)=>{
294-
console.log('play error',e)
295-
})
296-
//
297-
jessibuca.play()
298-
*/
299-
play(url?: string): Promise<void>;
317+
console.log('play success')
318+
}).catch((e)=>{
319+
console.log('play error',e)
320+
})
321+
// 添加请求头
322+
jessibuca.play('url',{headers:{'Authorization':'test111'}}).then(()=>{
323+
console.log('play success')
324+
}).catch((e)=>{
325+
console.log('play error',e)
326+
})
327+
*/
328+
play(url?: string, options?: {
329+
headers: Object
330+
}): Promise<void>;
300331

301332
/**
302333
* 重新调整视图大小
@@ -427,6 +458,21 @@ declare class Jessibuca {
427458
*/
428459
isRecording(): boolean;
429460

461+
/**
462+
* 切换底部控制条 隐藏/显示
463+
* @param isShow
464+
*
465+
* @example
466+
* jessibuca.toggleControlBar(true) // 显示
467+
* jessibuca.toggleControlBar(false) // 隐藏
468+
* jessibuca.toggleControlBar() // 切换 隐藏/显示
469+
*/
470+
toggleControlBar(isShow:boolean): void;
471+
472+
/**
473+
* 获取底部控制条是否显示
474+
*/
475+
getControlBarShow(): boolean;
430476

431477
/**
432478
* 监听 jessibuca 初始化事件
@@ -477,14 +523,14 @@ declare class Jessibuca {
477523
* 错误信息
478524
* @example
479525
* jessibuca.on("error",function(error){
480-
if(error === Jessibuca.ERROR.fetchError){
481-
//
482-
}
483-
else if(error === Jessibuca.ERROR.webcodecsH265NotSupport){
484-
//
485-
}
486-
console.log('error:',error)
487-
})
526+
if(error === Jessibuca.ERROR.fetchError){
527+
//
528+
}
529+
else if(error === Jessibuca.ERROR.webcodecsH265NotSupport){
530+
//
531+
}
532+
console.log('error:',error)
533+
})
488534
*/
489535
on(event: 'error', callback: (err: Jessibuca.ERROR) => void): void;
490536

demo/public/jessibuca.js

Lines changed: 29 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/public/jessibuca.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/public/pro.zip

-88.5 KB
Binary file not shown.

demo/public/pro/js/decoder-pro-audio.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/public/pro/js/decoder-pro-f-simd-mt.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/public/pro/js/decoder-pro-f-simd.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)