From c2b07ad943a8f195c53dce050b849496cabd192e Mon Sep 17 00:00:00 2001 From: winlin Date: Fri, 11 Feb 2022 08:44:31 +0800 Subject: [PATCH] Squash: Fix bugs --- .github/workflows/release.yml | 47 +++++++++++++++++++---- README.md | 1 + trunk/doc/CHANGELOG.md | 2 + trunk/research/players/js/srs.sdk.js | 10 ++++- trunk/research/players/rtc_publisher.html | 19 +++++++++ trunk/src/core/srs_core_version4.hpp | 2 +- 6 files changed, 71 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b8c846f6b..b2f22b727 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -81,7 +81,7 @@ jobs: docker push --all-tags ossrs/droplet # docker tag ossrs/lighthouse:$SRS_TAG ossrs/lighthouse:$SRS_MAJOR - docker tag ossrs/lighthouse:$SRS_TAG ossrs/lighthouse:latest + #docker tag ossrs/lighthouse:$SRS_TAG ossrs/lighthouse:latest docker push --all-tags ossrs/lighthouse # Aliyun ACR hub @@ -112,38 +112,69 @@ jobs: docker tag ossrs/lighthouse:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/lighthouse:$SRS_VERSION docker tag ossrs/lighthouse:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/lighthouse:v$SRS_MAJOR docker tag ossrs/lighthouse:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/lighthouse:$SRS_MAJOR - docker tag ossrs/lighthouse:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/lighthouse:latest + #docker tag ossrs/lighthouse:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/lighthouse:latest docker push --all-tags registry.cn-hangzhou.aliyuncs.com/ossrs/lighthouse - # Tencent TCR hub + # Tencent TCR Singapore hub # TODO: FIXME: If stable, please set the latest from 4.0 to 5.0 - - name: Login Tencent docker hub + - name: Login Tencent Singapore docker hub + uses: docker/login-action@v1 + with: + registry: sgccr.ccs.tencentyun.com + username: "${{ secrets.TCR_USERNAME }}" + password: "${{ secrets.TCR_PASSWORD }}" + - name: Push to Tencent Singapore docker hub + run: | + docker tag ossrs/srs:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/srs:$SRS_TAG + docker tag ossrs/srs:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/srs:$SRS_VERSION + docker tag ossrs/srs:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/srs:v$SRS_MAJOR + docker tag ossrs/srs:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/srs:$SRS_MAJOR + #docker tag ossrs/srs:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/srs:latest + docker push --all-tags sgccr.ccs.tencentyun.com/ossrs/srs + # + docker tag ossrs/droplet:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/droplet:$SRS_TAG + docker tag ossrs/droplet:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/droplet:$SRS_VERSION + docker tag ossrs/droplet:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/droplet:v$SRS_MAJOR + docker tag ossrs/droplet:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/droplet:$SRS_MAJOR + #docker tag ossrs/droplet:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/droplet:latest + docker push --all-tags sgccr.ccs.tencentyun.com/ossrs/droplet + # + docker tag ossrs/lighthouse:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/lighthouse:$SRS_TAG + docker tag ossrs/lighthouse:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/lighthouse:$SRS_VERSION + docker tag ossrs/lighthouse:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/lighthouse:v$SRS_MAJOR + docker tag ossrs/lighthouse:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/lighthouse:$SRS_MAJOR + #docker tag ossrs/lighthouse:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/lighthouse:latest + docker push --all-tags sgccr.ccs.tencentyun.com/ossrs/lighthouse + + # Tencent TCR Beijing hub + # TODO: FIXME: If stable, please set the latest from 4.0 to 5.0 + - name: Login Tencent Beijing docker hub uses: docker/login-action@v1 with: registry: ccr.ccs.tencentyun.com username: "${{ secrets.TCR_USERNAME }}" password: "${{ secrets.TCR_PASSWORD }}" - - name: Push to Tencent docker hub + - name: Push to Tencent Beijing docker hub run: | docker tag ossrs/srs:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/srs:$SRS_TAG docker tag ossrs/srs:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/srs:$SRS_VERSION docker tag ossrs/srs:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/srs:v$SRS_MAJOR docker tag ossrs/srs:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/srs:$SRS_MAJOR - docker tag ossrs/srs:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/srs:latest + #docker tag ossrs/srs:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/srs:latest docker push --all-tags ccr.ccs.tencentyun.com/ossrs/srs # docker tag ossrs/droplet:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/droplet:$SRS_TAG docker tag ossrs/droplet:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/droplet:$SRS_VERSION docker tag ossrs/droplet:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/droplet:v$SRS_MAJOR docker tag ossrs/droplet:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/droplet:$SRS_MAJOR - docker tag ossrs/droplet:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/droplet:latest + #docker tag ossrs/droplet:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/droplet:latest docker push --all-tags ccr.ccs.tencentyun.com/ossrs/droplet # docker tag ossrs/lighthouse:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/lighthouse:$SRS_TAG docker tag ossrs/lighthouse:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/lighthouse:$SRS_VERSION docker tag ossrs/lighthouse:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/lighthouse:v$SRS_MAJOR docker tag ossrs/lighthouse:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/lighthouse:$SRS_MAJOR - docker tag ossrs/lighthouse:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/lighthouse:latest + #docker tag ossrs/lighthouse:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/lighthouse:latest docker push --all-tags ccr.ccs.tencentyun.com/ossrs/lighthouse ################################################################################################################## diff --git a/README.md b/README.md index e21a016a6..f57739809 100755 --- a/README.md +++ b/README.md @@ -134,6 +134,7 @@ We are grateful to the community for contributing bugfix and improvements, pleas ## Releases +* 2022-02-09, Release [v4.0-b7](https://github.com/ossrs/srs/releases/tag/v4.0-b7), v4.0-b7, 4.0 beta7, v4.0.240, 144437 lines. * 2022-02-04, Release [v4.0-b6](https://github.com/ossrs/srs/releases/tag/v4.0-b6), v4.0-b6, 4.0 beta6, v4.0.238, 144437 lines. * 2022-01-30, Release [v4.0-b5](https://github.com/ossrs/srs/releases/tag/v4.0-b5), v4.0-b5, 4.0 beta5, v4.0.236, 144416 lines. * 2022-01-17, Release [v4.0-b4](https://github.com/ossrs/srs/releases/tag/v4.0-b4), v4.0-b4, 4.0 beta4, v4.0.230, 144393 lines. diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index 8d0a6c58f..1fbc22418 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -32,6 +32,8 @@ The changelog for SRS. ## SRS 4.0 Changelog +* v4.0, 2022-02-09, Mirror docker images in TCR Singapore. v4.0.240 +* v4.0, 2022-02-08, Refine the error for WebRTC H5 publisher. v4.0.239 * v4.0, 2022-02-04, Push docker to docker, acr and tcr. v4.0.238 * v4.0, 2022-02-03, Merge [#2888](https://github.com/ossrs/srs/pull/2888): Fix bug when the value of http header is empty. (#2888). v4.0.237 * v4.0, 2022-01-30, Refine docker console, preview by players at the same server. v4.0.236 diff --git a/trunk/research/players/js/srs.sdk.js b/trunk/research/players/js/srs.sdk.js index 5cda7947c..2edcaa4b8 100644 --- a/trunk/research/players/js/srs.sdk.js +++ b/trunk/research/players/js/srs.sdk.js @@ -7,6 +7,14 @@ 'use strict'; +function SrsError(name, message) { + this.name = name; + this.message = message; + this.stack = (new Error()).stack; +} +SrsError.prototype = Object.create(Error.prototype); +SrsError.prototype.constructor = SrsError; + // Depends on adapter-7.4.0.min.js from https://github.com/webrtc/adapter // Async-awat-prmise based SRS RTC Publisher. function SrsRtcPublisherAsync() { @@ -48,7 +56,7 @@ function SrsRtcPublisherAsync() { self.pc.addTransceiver("video", {direction: "sendonly"}); if (!navigator.mediaDevices && window.location.protocol === 'http:' && window.location.hostname !== 'localhost') { - throw new Error(`Please use HTTPS or localhost to publish, read https://github.com/ossrs/srs/issues/2762#issuecomment-983147576`); + throw new SrsError('HttpsRequiredError', `Please use HTTPS or localhost to publish, read https://github.com/ossrs/srs/issues/2762#issuecomment-983147576`); } var stream = await navigator.mediaDevices.getUserMedia(self.constraints); diff --git a/trunk/research/players/rtc_publisher.html b/trunk/research/players/rtc_publisher.html index 4c1fe76dd..e7b6984b7 100644 --- a/trunk/research/players/rtc_publisher.html +++ b/trunk/research/players/rtc_publisher.html @@ -99,6 +99,25 @@ $(function(){ $('#sessionid').html(session.sessionid); $('#simulator-drop').attr('href', session.simulator + '?drop=1&username=' + session.sessionid); }).catch(function (reason) { + // Throw by sdk. + if (reason instanceof SrsError) { + if (reason.name === 'HttpsRequiredError') { + alert(`WebRTC推流必须是HTTPS或者localhost:${reason.name} ${reason.message}`); + } else { + alert(`${reason.name} ${reason.message}`); + } + } + // See https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#exceptions + if (reason instanceof DOMException) { + if (reason.name === 'NotFoundError') { + alert(`找不到麦克风和摄像头设备:getUserMedia ${reason.name} ${reason.message}`); + } else if (reason.name === 'NotAllowedError') { + alert(`你禁止了网页访问摄像头和麦克风:getUserMedia ${reason.name} ${reason.message}`); + } else if (['AbortError', 'NotAllowedError', 'NotFoundError', 'NotReadableError', 'OverconstrainedError', 'SecurityError', 'TypeError'].includes(reason.name)) { + alert(`getUserMedia ${reason.name} ${reason.message}`); + } + } + sdk.close(); $('#rtc_media_player').hide(); console.error(reason); diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index 3b3caea9c..3adbb2270 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 238 +#define VERSION_REVISION 240 #endif