mirror of
https://github.com/koush/scrypted.git
synced 2026-06-20 16:40:30 +01:00
sdk/core/ring: restrict microphone request hackery to safari/ring only
This commit is contained in:
@@ -137,13 +137,22 @@ export class BrowserSignalingSession implements RTCSignalingSession {
|
||||
}
|
||||
|
||||
if (setup.audio) {
|
||||
const audio = pc.addTransceiver('audio', setup.audio);
|
||||
if (setup.audio.direction === 'sendrecv' || setup.audio.direction === 'sendonly') {
|
||||
// offering a sendrecv on safari requires a mic be attached, or it fails to connect,
|
||||
let audio: RTCRtpTransceiver;
|
||||
if (setup.getUserMediaSafariHack && navigator.userAgent.includes('Safari') && !navigator.userAgent.includes('Chrome')) {
|
||||
// offering a sendrecv on safari requires a mic be attached for ring webrtc, or it fails to stream?
|
||||
// even if a silent track is used...
|
||||
if (setup.type === 'offer' && navigator.userAgent.includes('Safari') && !navigator.userAgent.includes('Chrome'))
|
||||
await navigator.mediaDevices.getUserMedia({ audio: true })
|
||||
audio = pc.addTransceiver('audio', {
|
||||
...setup.audio,
|
||||
streams: [
|
||||
await navigator.mediaDevices.getUserMedia({ audio: true })
|
||||
],
|
||||
});
|
||||
}
|
||||
else {
|
||||
audio = pc.addTransceiver('audio', setup.audio);
|
||||
}
|
||||
|
||||
if (setup.audio.direction === 'sendrecv' || setup.audio.direction === 'sendonly') {
|
||||
this.microphone = audio.sender;
|
||||
}
|
||||
}
|
||||
|
||||
4
plugins/core/package-lock.json
generated
4
plugins/core/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/core",
|
||||
"version": "0.1.78",
|
||||
"version": "0.1.80",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/core",
|
||||
"version": "0.1.78",
|
||||
"version": "0.1.80",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@scrypted/common": "file:../../common",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/core",
|
||||
"version": "0.1.78",
|
||||
"version": "0.1.80",
|
||||
"description": "Scrypted Core plugin. Provides the UI, websocket, and engine.io APIs.",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
4
plugins/ring/package-lock.json
generated
4
plugins/ring/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/ring",
|
||||
"version": "0.0.91",
|
||||
"version": "0.0.92",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/ring",
|
||||
"version": "0.0.91",
|
||||
"version": "0.0.92",
|
||||
"dependencies": {
|
||||
"@koush/ring-client-api": "file:../../external/ring-client-api",
|
||||
"@scrypted/common": "file:../../common",
|
||||
|
||||
@@ -44,5 +44,5 @@
|
||||
"got": "11.8.2",
|
||||
"socket.io-client": "^2.4.0"
|
||||
},
|
||||
"version": "0.0.91"
|
||||
"version": "0.0.92"
|
||||
}
|
||||
|
||||
@@ -441,6 +441,7 @@ class RingCameraDevice extends ScryptedDeviceBase implements DeviceProvider, Cam
|
||||
video: {
|
||||
direction: 'recvonly',
|
||||
},
|
||||
getUserMediaSafariHack: true,
|
||||
}, {
|
||||
createLocalDescription: async (type: 'offer' | 'answer', setup: RTCAVSignalingSetup, sendIceCandidate: RTCSignalingSendIceCandidate) => {
|
||||
if (type !== 'answer')
|
||||
|
||||
4
sdk/package-lock.json
generated
4
sdk/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/sdk",
|
||||
"version": "0.2.49",
|
||||
"version": "0.2.51",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/sdk",
|
||||
"version": "0.2.49",
|
||||
"version": "0.2.51",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/sdk",
|
||||
"version": "0.2.49",
|
||||
"version": "0.2.51",
|
||||
"description": "",
|
||||
"main": "dist/src/index.js",
|
||||
"exports": {
|
||||
|
||||
4
sdk/types/package-lock.json
generated
4
sdk/types/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/types",
|
||||
"version": "0.2.46",
|
||||
"version": "0.2.48",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/types",
|
||||
"version": "0.2.46",
|
||||
"version": "0.2.48",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@types/rimraf": "^3.0.2",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/types",
|
||||
"version": "0.2.46",
|
||||
"version": "0.2.48",
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"author": "",
|
||||
|
||||
@@ -1851,8 +1851,12 @@ export interface RTCAVSignalingSetup {
|
||||
* Mechanism to allow configuration of TURN/STUN servers, etc.
|
||||
*/
|
||||
configuration?: RTCConfiguration;
|
||||
audio: RTCRtpTransceiverInit;
|
||||
video: RTCRtpTransceiverInit;
|
||||
audio?: RTCRtpTransceiverInit;
|
||||
video?: RTCRtpTransceiverInit;
|
||||
/**
|
||||
* Some endpoints like Ring do not stream to Safari unless getUserMedia is called. Unclear why.
|
||||
*/
|
||||
getUserMediaSafariHack?: boolean;
|
||||
datachannel?: {
|
||||
label: string;
|
||||
dict?: RTCDataChannelInit;
|
||||
|
||||
Reference in New Issue
Block a user