Skip to content

Commit

Permalink
代码,能跑就行了,废物只懂得cr
Browse files Browse the repository at this point in the history
  • Loading branch information
numberwolf committed Jul 27, 2022
1 parent 566a222 commit ef9261a
Show file tree
Hide file tree
Showing 21 changed files with 92 additions and 17 deletions.
1 change: 1 addition & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
| 获取 视频帧率 || ---- |
| 获取 音频采样率 || ---- |
| 追帧策略算法 || HTTP-FLV(no audio) |
| 倍速调整 || H.264/AV1 |

<br>

Expand Down
3 changes: 3 additions & 0 deletions README_EN.MD
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ Notice:
| Get Video FPS | Y | ---- |
| Get Audio SampleRate | Y | ---- |
| Chase Frame | Y | HTTP-FLV(no audio) |
| PlayBackRate | Y | H.264/AV1 |

<br>

Expand Down Expand Up @@ -955,6 +956,8 @@ ffmpeg -ss 20 -t 10 -i ./res/xinxiaomen.mp4 \

| Update | Content |
| ---- | ---- |
| Time | 2022/07/27 |
| - | 0.Support: PlayBackRate |
| Time | 2022/07/12 |
| - | 0.Fixed some problem |
| Time | 2022/07/06-10 |
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist-multi-thread/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* Github: https://github.com/numberwolf/h265web.js
*
**********************************************************/
require('./h265webjs-v20220712');
require('./h265webjs-v20220727');
export default class h265webjs {
static createPlayer(videoURL, config) {
return window.new265webjs(videoURL, config);
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* Github: https://github.com/numberwolf/h265web.js
*
**********************************************************/
require('./h265webjs-v20220712');
require('./h265webjs-v20220727');
export default class h265webjs {
static createPlayer(videoURL, config) {
return window.new265webjs(videoURL, config);
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example_normal/dist-multi-thread/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* Github: https://github.com/numberwolf/h265web.js
*
**********************************************************/
require('./h265webjs-v20220712');
require('./h265webjs-v20220727');
export default class h265webjs {
static createPlayer(videoURL, config) {
return window.new265webjs(videoURL, config);
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example_normal/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* Github: https://github.com/numberwolf/h265web.js
*
**********************************************************/
require('./h265webjs-v20220712');
require('./h265webjs-v20220727');
export default class h265webjs {
static createPlayer(videoURL, config) {
return window.new265webjs(videoURL, config);
Expand Down
2 changes: 1 addition & 1 deletion example_normal/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<link rel="stylesheet" type="text/css" href='player-view/css/button.css'>
<link rel="stylesheet" type="text/css" href='player-view/css/progress.css'>
<script src="dist/missile.js"></script>
<script src="dist/h265webjs-v20220712.js"></script>
<script src="dist/h265webjs-v20220727.js"></script>
<script src="index.js"></script>

</head>
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example_vue/public/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* Github: https://github.com/numberwolf/h265web.js
*
**********************************************************/
require('./h265webjs-v20220706');
require('./h265webjs-v20220727');
export default class h265webjs {
static createPlayer(videoURL, config) {
return window.new265webjs(videoURL, config);
Expand Down
4 changes: 2 additions & 2 deletions index-debug.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
<meta charset="utf-8" name="github" content="https://github.com/numberwolf/h265web.js">

<script src="dist/missile.js"></script> <!-- IMPORTANT -->
<script src="dist/h265webjs-v20220712.js"></script> <!-- IMPORTANT -->
<script src="dist/h265webjs-v20220727.js"></script> <!-- IMPORTANT -->

<!--<script src="dist-multi-thread/missile-multi-thread.js"></script>
<script src="dist-multi-thread/h265webjs-v20220712.js"></script>-->
<script src="dist-multi-thread/h265webjs-v20220727.js"></script>-->

<style>
</style>
Expand Down
21 changes: 20 additions & 1 deletion src/src/h265webjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ class H265webjsModule {
} // end if c
}
}, 500);

}

release() {
Expand Down Expand Up @@ -422,6 +421,26 @@ class H265webjsModule {
this.player.debugYUV(debugID);
}

setPlaybackRate(rate=1.0) {
if (this.playParam.videoCodec === def.CODEC_H265 ||
rate <= 0.0 ||
this.player === undefined || this.player === null) {
return false;
}
// playbackRate
return this.player.setPlaybackRate(rate);
}

getPlaybackRate() {
if (this.player === undefined || this.player === null) {
return false;
}
if (this.playParam.videoCodec === def.CODEC_H265) {
return 1.0;
}
return this.player.getPlaybackRate();
}

setRenderScreen(setVal = false) {
if (this.player === undefined || this.player === null) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* Github: https://github.com/numberwolf/h265web.js
*
**********************************************************/
require('./h265webjs-v20220712');
require('./h265webjs-v20220727');
export default class h265webjs {
static createPlayer(videoURL, config) {
return window.new265webjs(videoURL, config);
Expand Down
18 changes: 18 additions & 0 deletions src/src/native/mp4-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class Mp4PlayerModule {

let canvasBox = document.querySelector('div#' + this.configFormat.playerId);
this.videoTag = document.createElement('video');
// playbackRate = 1.0;

if (this.configFormat.autoPlay === true) {
this.videoTag.muted = "muted";
Expand Down Expand Up @@ -100,6 +101,23 @@ class Mp4PlayerModule {
canvasBox.appendChild(this.videoTag);
}

setPlaybackRate(rate=1.0) {
if (rate <= 0.0 ||
this.videoTag == undefined || this.videoTag === null) {
return false;
}
// playbackRate
this.videoTag = rate;
return true;
}

getPlaybackRate() {
if (this.videoTag == undefined || this.videoTag === null) {
return 0;
}
return this.videoTag.playbackRate;
}

getSize() {
const width = this.videoTag.videoWidth > 0 ? this.videoTag.videoWidth : this.configFormat.width;
const height = this.videoTag.videoHeight > 0 ? this.videoTag.videoHeight : this.configFormat.height;
Expand Down
17 changes: 17 additions & 0 deletions src/src/native/nv-flvjs-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,23 @@ class NvFlvjsCoreModule {
} // flvjs.isSupported
} // makeIt

setPlaybackRate(rate=1.0) {
if (rate <= 0.0 ||
this.videoTag == undefined || this.videoTag === null) {
return false;
}
// playbackRate
this.videoTag.playbackRate = rate;
return true;
}

getPlaybackRate() {
if (this.videoTag == undefined || this.videoTag === null) {
return 0;
}
return this.videoTag.playbackRate;
}

getSize() {
const width = this.videoTag.videoWidth > 0 ? this.videoTag.videoWidth : this.width;
const height = this.videoTag.videoHeight > 0 ? this.videoTag.videoHeight : this.height;
Expand Down
17 changes: 17 additions & 0 deletions src/src/native/nv-videojs-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,23 @@ class NvVideojsCoreModule {
this._hiddenUnusedPlugins();
} // makeIt

setPlaybackRate(rate=1.0) {
if (rate <= 0.0 ||
this.videoTag == undefined || this.videoTag === null) {
return false;
}
// playbackRate
this.videoTag = rate;
return true;
}

getPlaybackRate() {
if (this.videoTag == undefined || this.videoTag === null) {
return 0;
}
return this.videoTag.playbackRate;
}

getSize() {
if (this.myPlayer.videoWidth() <= 0) {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/src/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
*
**********************************************************/
module.exports = {
PLAYER_VERSION : "4.1.0",
PLAYER_VERSION : "4.2.0",
};
2 changes: 1 addition & 1 deletion src/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
# * Github: https://github.com/numberwolf/h265web.js
# *
# **********************************************************/
VERSION='v20220712' # output version + index.js
VERSION='v20220727' # output version + index.js
WASM_VERSION='v20220706'

0 comments on commit ef9261a

Please sign in to comment.