Skip to content

Commit

Permalink
Update go2rtc version to 1.9.4
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Sep 8, 2024
1 parent 61f3ea9 commit 8450369
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion custom_components/webrtc/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

DOMAIN = "webrtc"

BINARY_VERSION = "1.8.4"
BINARY_VERSION = "1.9.4"

SYSTEM = {
"Windows": {"AMD64": "go2rtc_win64.zip", "ARM64": "go2rtc_win_arm64.zip"},
Expand Down
12 changes: 10 additions & 2 deletions custom_components/webrtc/www/video-rtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class VideoRTC extends HTMLElement {
super();

this.DISCONNECT_TIMEOUT = 5000;
this.RECONNECT_TIMEOUT = 30000;
this.RECONNECT_TIMEOUT = 15000;

this.CODECS = [
'avc1.640029', // H.264 high 4.1 (Chromecast 1st and 2nd Gen)
Expand Down Expand Up @@ -70,6 +70,7 @@ export class VideoRTC extends HTMLElement {
* @type {RTCConfiguration}
*/
this.pcConfig = {
bundlePolicy: 'max-bundle',
iceServers: [{urls: 'stun:stun.l.google.com:19302'}],
sdpSemantics: 'unified-plan', // important for Chromecast 1
};
Expand Down Expand Up @@ -248,6 +249,11 @@ export class VideoRTC extends HTMLElement {

this.appendChild(this.video);

this.video.addEventListener('error', ev => {
console.warn(ev);
if (this.ws) this.ws.close(); // run reconnect for broken MSE stream
});

// all Safari lies about supported audio codecs
const m = window.navigator.userAgent.match(/Version\/(\d+).+Safari/);
if (m) {
Expand Down Expand Up @@ -487,7 +493,9 @@ export class VideoRTC extends HTMLElement {

pc.addEventListener('connectionstatechange', () => {
if (pc.connectionState === 'connected') {
const tracks = pc.getReceivers().map(receiver => receiver.track);
const tracks = pc.getTransceivers()
.filter(tr => tr.currentDirection === 'recvonly') // skip inactive
.map(tr => tr.receiver.track);
/** @type {HTMLVideoElement} */
const video2 = document.createElement('video');
video2.addEventListener('loadeddata', () => this.onpcvideo(video2), {once: true});
Expand Down
2 changes: 1 addition & 1 deletion custom_components/webrtc/www/webrtc-camera.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** Chrome 63+, Safari 11.1+ */
import {VideoRTC} from './video-rtc.js?v=1.8.0';
import {VideoRTC} from './video-rtc.js?v=1.9.4';
import {DigitalPTZ} from './digital-ptz.js?v=3.3.0';

class WebRTCCamera extends VideoRTC {
Expand Down

0 comments on commit 8450369

Please sign in to comment.