Skip to content

Commit

Permalink
刚写完才发现没烟了...
Browse files Browse the repository at this point in the history
  • Loading branch information
numberwolf committed Dec 23, 2021
1 parent 29656ee commit 6bea883
Show file tree
Hide file tree
Showing 14 changed files with 131 additions and 61 deletions.
2 changes: 2 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,8 @@ ffmpeg -ss 20 -t 10 -i ./res/xinxiaomen.mp4 \

| 更新日志 | 内容 |
| ---- | ---- |
| 时间 | 2021/12/24 |
| - | 0.修复 H.264 HTTP-FLV 部分流无回调问题 |
| 时间 | 2021/12/19 |
| - | 0.修复 H.264 HLS 回调不响应的问题 |
| 时间 | 2021/12/08 |
Expand Down
2 changes: 2 additions & 0 deletions README_EN.MD
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,8 @@ ffmpeg -ss 20 -t 10 -i ./res/xinxiaomen.mp4 \

| Update | Content |
| ---- | ---- |
| Time | 2021/12/24 |
| - | 0.Fixed H.264 HTTP-FLV Some Badcase with callback |
| Time | 2021/12/19 |
| - | 0.Fixed H.264 HLS Callback's problem |
| Time | 2021/12/08 |
Expand Down
18 changes: 9 additions & 9 deletions dist/h265webjs-v20211219.js → dist/h265webjs-v20211224.js

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-v20211219');
require('./h265webjs-v20211224');
export default class h265webjs {
static createPlayer(videoURL, config) {
return window.new265webjs(videoURL, config);
Expand Down
18 changes: 9 additions & 9 deletions example/dist/dist-play.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example/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-v20211219');
require('./h265webjs-v20211224');
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-v20211219');
require('./h265webjs-v20211224');
export default class h265webjs {
static createPlayer(videoURL, config) {
return window.new265webjs(videoURL, config);
Expand Down
4 changes: 2 additions & 2 deletions example_normal/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ window.onload = function() {
//var url = "res/hls/veilside.m3u8";
//var url = "res/hls1/test.m3u8";
//var url = "http://182.61.31.911:8080/live/livestream.flv";
var url = "http://127.0.0.1/live/test/hls.m3u8";
//var url = "http://127.0.0.1/live/test/hls.m3u8";

/******** Websocket FLV/TS ********/
// var url = "ws://127.0.0.1/live/test.flv";
// var url = "ws://127.0.0.1/live/test.live.ts";

/******** HTTP FLV/TS/HLS ********/
var url = "http://127.0.0.1/live/test.flv";
// var url = "http://127.0.0.1/live/test.flv";
// var url = "http://127.0.0.1/live/test.live.ts";
// var url = "http://127.0.0.1/live/test/hls.m3u8";
var 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 @@ -36,7 +36,7 @@
<link rel="stylesheet" type="text/css" href='player-view/css/progress.css'>
<script src="dist/missile.js"></script> <!-- IMPORTANT -->
<!--<script src="dist/missile-256mb-v20211104.js"></script>--> <!-- wasm for 265mb memory(with grow) -->
<script src="dist/h265webjs-v20211219.js"></script> <!-- IMPORTANT -->
<script src="dist/h265webjs-v20211224.js"></script> <!-- IMPORTANT -->
<script src="example.js"></script> <!-- IMPORTANT -->
<style>
</style>
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-v20211219');
require('./h265webjs-v20211224');
export default class h265webjs {
static createPlayer(videoURL, config) {
return window.new265webjs(videoURL, config);
Expand Down
100 changes: 83 additions & 17 deletions src/src/native/nv-flvjs-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,39 +100,105 @@ class NvFlvjsCoreModule {
// native
let _this = this;
if (flvjs.isSupported()) {
console.log("flvjs-core flvjs.isSupported");
let h265Container = document.querySelector('#' + this.configFormat.playerId);
this.videoTag = document.createElement('video');
this.videoTag.id = this.myPlayerID;
this.videoTag.style.width = this.configFormat.width + 'px';
this.videoTag.style.height = this.configFormat.height + 'px';
h265Container.appendChild(this.videoTag);

this.videoTag.onloadedmetadata = () => {
alert("this.videoTag.onloadedmetadata");
if (isInitDecodeFrames === false && _this.videoTag.videoWidth > 0 && _this.videoTag.videoHeight > 0)
{
isInitDecodeFrames = true;
_this.width = _this.videoTag.videoWidth;
_this.height = _this.videoTag.videoHeight;
_this.duration = _this.videoTag.duration;
alert(_this.duration);
_this.onLoadFinish && _this.onLoadFinish();
_this.onReadyShowDone && _this.onReadyShowDone();

_this.videoTag.ontimeupdate = () => {
console.log("ontimeupdate");
_this.onPlayingTime && _this.onPlayingTime(_this.videoTag.currentTime);
}; // ontimeupdate
_this.videoTag.onended = () => {
console.log("onended");
_this.onPlayingFinish && _this.onPlayingFinish();
}; // onended
}
}; // onloadedmetadata

let options = {
type: 'flv',
// url: 'http://localhost:8080/VideoMissile/VideoMissilePlayer/demo/res/jitui10.flv'
//url: 'http://182.61.31.119:8080/live/livestream.flv',
url: url,
}; // options
this.myPlayer = flvjs.createPlayer(options);

let isInitDecodeFrames = false;

this.myPlayer.on(flvjs.Events.MEDIA_INFO, function(res) {
console.log("Events.MEDIA_INFO", res);
});
this.myPlayer.on(flvjs.Events.STATISTICS_INFO, function(res) {
console.log("Events.STATISTICS_INFO",
res,
_this.videoTag.videoWidth, _this.videoTag.videoHeight,
_this.videoTag.duration);
if (isInitDecodeFrames === false && _this.videoTag.videoWidth > 0 && _this.videoTag.videoHeight > 0)
{
isInitDecodeFrames = true;
_this.width = _this.videoTag.videoWidth;
_this.height = _this.videoTag.videoHeight;
_this.duration = _this.videoTag.duration;
alert(_this.duration);
_this.onLoadFinish && _this.onLoadFinish();
_this.onReadyShowDone && _this.onReadyShowDone();

_this.videoTag.ontimeupdate = () => {
console.log("ontimeupdate");
_this.onPlayingTime && _this.onPlayingTime(_this.videoTag.currentTime);
}; // ontimeupdate
_this.videoTag.onended = () => {
console.log("onended");
_this.onPlayingFinish && _this.onPlayingFinish();
}; // onended
}
});
this.myPlayer.on(flvjs.Events.SCRIPTDATA_ARRIVED, function(res) {
console.log("Events.SCRIPTDATA_ARRIVED", res);
});
this.myPlayer.on(flvjs.Events.METADATA_ARRIVED, function(res) {
alert("METADATA_ARRIVED");
console.log("METADATA_ARRIVED", res);
_this.duration = res.duration;
_this.width = res.width;
_this.height = res.height;
alert(_this.duration);
_this.onLoadFinish && _this.onLoadFinish();
_this.onReadyShowDone && _this.onReadyShowDone();

_this.videoTag.ontimeupdate = () => {
console.log("ontimeupdate");
_this.onPlayingTime && _this.onPlayingTime(_this.videoTag.currentTime);
}; // ontimeupdate
_this.videoTag.onended = () => {
console.log("onended");
_this.onPlayingFinish && _this.onPlayingFinish();
}; // onended
if (isInitDecodeFrames === false)
{
isInitDecodeFrames = true;
alert("METADATA_ARRIVED");
console.log("Events.METADATA_ARRIVED", res);
_this.duration = res.duration;
_this.width = res.width;
_this.height = res.height;
alert(_this.duration);
_this.onLoadFinish && _this.onLoadFinish();
_this.onReadyShowDone && _this.onReadyShowDone();

_this.videoTag.ontimeupdate = () => {
console.log("ontimeupdate");
_this.onPlayingTime && _this.onPlayingTime(_this.videoTag.currentTime);
}; // ontimeupdate
_this.videoTag.onended = () => {
console.log("onended");
_this.onPlayingFinish && _this.onPlayingFinish();
}; // onended
}
}); // METADATA_ARRIVED
this.myPlayer.on(flvjs.Events.ERROR, function(res) {
console.log("Events.ERROR", res);
});

this.myPlayer.attachMediaElement(this.videoTag);
this.myPlayer.load();
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
# * Github: https://github.com/numberwolf/h265web.js
# *
# **********************************************************/
VERSION='v20211219' # output version + index.js
VERSION='v20211224' # output version + index.js

0 comments on commit 6bea883

Please sign in to comment.