Skip to content

Commit

Permalink
Merge pull request #187 from girlbymirror/master
Browse files Browse the repository at this point in the history
fixed:cannot play hevc file's url without text of http
  • Loading branch information
girlbymirror authored Sep 12, 2022
2 parents 539221a + 92417a0 commit 17102ae
Show file tree
Hide file tree
Showing 21 changed files with 145 additions and 46 deletions.
2 changes: 2 additions & 0 deletions README_EN.MD
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,8 @@ ffmpeg -ss 20 -t 10 -i ./res/xinxiaomen.mp4 \

| Update | Content |
| ---- | ---- |
| Time | 2022/09/12 |
| - | 0.Fixed: hevc url cannot play without text of "http" |
| Time | 2022/08/24 |
| - | 0.Feature: Safari with native player(version>13) |
| Time | 2022/08/23 |
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-v20220828');
require('./h265webjs-v20220912');
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-v20220828');
require('./h265webjs-v20220912');
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-v20220828');
require('./h265webjs-v20220912');
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-v20220828');
require('./h265webjs-v20220912');
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-v20220828.js"></script>
<script src="dist/h265webjs-v20220912.js"></script>
<script src="index.js"></script>

</head>
Expand Down

Large diffs are not rendered by default.

7 changes: 3 additions & 4 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-v20220828.js"></script> <!-- IMPORTANT -->
<script src="dist/h265webjs-v20220912.js"></script> <!-- IMPORTANT -->

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

<style>
</style>
Expand Down Expand Up @@ -66,12 +66,11 @@
"height": 360,
"token" : "base64:QXV0aG9yOmNoYW5neWFubG9uZ3xudW1iZXJ3b2xmLEdpdGh1YjpodHRwczovL2dpdGh1Yi5jb20vbnVtYmVyd29sZixFbWFpbDpwb3JzY2hlZ3QyM0Bmb3htYWlsLmNvbSxRUTo1MzEzNjU4NzIsSG9tZVBhZ2U6aHR0cDovL3h2aWRlby52aWRlbyxEaXNjb3JkOm51bWJlcndvbGYjODY5NCx3ZWNoYXI6bnVtYmVyd29sZjExLEJlaWppbmcsV29ya0luOkJhaWR1",
"extInfo" : {
"coreProbePart" : 0.4,
"probeSize" : 8192,
"ignoreAudio" : 0,
"coreProbePart" : 0.1,
"autoPlay" : false,
"cacheLength" : 50,
"cacheLength" : 24,
"rawFps": 24
}
}
Expand Down
49 changes: 48 additions & 1 deletion src/src/decoder/av-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,59 @@ function BrowserJudge() {
return [System.type, System.version];
}

function ParseGetMediaURL(mediaFile, protocol='http') {

console.log('protocol', protocol);

if (protocol !== 'http' && protocol !== 'ws' && protocol !== 'wss') {
if (mediaFile.indexOf('ws') >= 0 || mediaFile.indexOf('wss') >= 0) {
protocol = 'ws';
}
}

if (protocol === 'ws' || protocol === 'wss') {
return mediaFile;
}

let mediaURI = mediaFile;
if (mediaFile.indexOf(protocol) >= 0) {
mediaURI = mediaFile;

console.log('mediaURI 1', mediaURI);
} else {
if (mediaFile[0] === '/') {
if (mediaFile[1] === '/') {
mediaURI = protocol + ':' + mediaFile;
} else {
mediaURI = window.location.origin + mediaFile
}

console.log('mediaURI 2', mediaURI);
} else if (mediaFile[0] === ':') {
mediaURI = protocol + mediaFile;

console.log('mediaURI 3', mediaURI);
} else {
let split_ret = window.location.href.split('/');
mediaURI = window.location.href.replace(
split_ret[split_ret.length - 1], mediaFile);

console.log('mediaURI 4', mediaURI);
}
}

console.log('mediaURI 5', mediaURI);

return mediaURI;
} // end function ParseGetMediaURL

module.exports = {
frameDataAlignCrop : frameDataAlignCrop,
GetUriFormat : GetUriFormat,
GetFormatPlayCore : GetFormatPlayCore,
GetUriProtocol : GetUriProtocol,
GetMsTime : GetMsTime,
GetScriptPath : GetScriptPath,
BrowserJudge : BrowserJudge
BrowserJudge : BrowserJudge,
ParseGetMediaURL : ParseGetMediaURL
}; // module exports
4 changes: 2 additions & 2 deletions src/src/decoder/c-http-g711-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class CHttpG711CoreModule { // export default
this.onRender = null;
// this.onCacheProcess = null;
this.onReadyShowDone = null;
this.onNetworkError = null;
this.onError = null;
this.onPlayState = null;

// run
Expand Down Expand Up @@ -280,7 +280,7 @@ class CHttpG711CoreModule { // export default
*/
break;
case 'fetch-error':
_this.onNetworkError && _this.onNetworkError(body.data);
_this.onError && _this.onError(body.data);
default:
break;
} // end switch
Expand Down
5 changes: 3 additions & 2 deletions src/src/decoder/c-httplive-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class CHttpLiveCoreModule { // export default
this.onRender = null;
// this.onCacheProcess = null;
this.onReadyShowDone = null;
this.onNetworkError = null;
this.onError = null;
this.onPlayState = null;

// run
Expand Down Expand Up @@ -313,6 +313,7 @@ class CHttpLiveCoreModule { // export default
case 'close':
_this.AVGetInterval && clearInterval(_this.AVGetInterval);
_this.AVGetInterval = null;
break;
case 'fetch-fin':
// fetchFinished = true;
/*
Expand All @@ -324,7 +325,7 @@ class CHttpLiveCoreModule { // export default
*/
break;
case 'fetch-error':
_this.onNetworkError && _this.onNetworkError(body.data);
_this.onError && _this.onError(body.data);
default:
break;
} // end switch
Expand Down
4 changes: 2 additions & 2 deletions src/src/decoder/c-wslive-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class CWsLiveCoreModule { // export default
this.onRender = null;
// this.onCacheProcess = null;
this.onReadyShowDone = null;
this.onNetworkError = null;
this.onError = null;

// run
const TOKEN_SECRET = "base64:QXV0aG9yOmNoYW5neWFubG9uZ3xudW1iZXJ3b2xmLEdpdGh1YjpodHRwczovL2dpdGh1Yi5jb20vbnVtYmVyd29sZixFbWFpbDpwb3JzY2hlZ3QyM0Bmb3htYWlsLmNvbSxRUTo1MzEzNjU4NzIsSG9tZVBhZ2U6aHR0cDovL3h2aWRlby52aWRlbyxEaXNjb3JkOm51bWJlcndvbGYjODY5NCx3ZWNoYXI6bnVtYmVyd29sZjExLEJlaWppbmcsV29ya0luOkJhaWR1";
Expand Down Expand Up @@ -265,7 +265,7 @@ class CWsLiveCoreModule { // export default
*/
break;
case 'fetch-error':
_this.onNetworkError && _this.onNetworkError(body.data);
_this.onError && _this.onError(body.data);
default:
break;
} // end switch
Expand Down
22 changes: 22 additions & 0 deletions src/src/demuxer/untitled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function getMediaURL(mediaFile) {
let mediaURI = mediaFile;
if (mediaFile.indexOf("http") >= 0) {
mediaURI = mediaFile;
} else {
if (mediaFile[0] === '/') {
if (mediaFile[1] === '/') {
mediaURI = 'http:' + mediaFile;
} else {
mediaURI = window.location.origin + mediaFile
}
} else if (mediaFile[0] === ':') {
mediaURI = 'http' + mediaFile;
} else {
let split_ret = window.location.href.split('/');
mediaURI = window.location.href.replace(
split_ret[split_ret.length - 1], mediaFile);
}
}

return mediaURI;
} // end function getMediaURL
Loading

0 comments on commit 17102ae

Please sign in to comment.