Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
5075e544
提交
5075e544
authored
12月 31, 2018
作者:
Marcell Guilherme Costa da Silva
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-11370 [verto_communicator] verto may rely on device labels to assure correct mic/cam selection
上级
e4d85ee6
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
89 行增加
和
32 行删除
+89
-32
jquery.FSRTC.js
html5/verto/js/src/jquery.FSRTC.js
+78
-30
jquery.verto.js
html5/verto/js/src/jquery.verto.js
+11
-2
media-device-id.min.js
html5/verto/js/src/vendor/media-device-id.min.js
+0
-0
没有找到文件。
html5/verto/js/src/jquery.FSRTC.js
浏览文件 @
5075e544
...
...
@@ -455,9 +455,11 @@
audio
:
false
,
video
:
{
deviceId
:
params
.
useCamera
},
},
localVideo
:
self
.
options
.
localVideo
,
localVideo
:
self
.
options
.
localVideo
,
useCameraLabel
:
self
.
options
.
useCameraLabel
,
useMicLabel
:
self
.
options
.
useMicLabel
,
onsuccess
:
function
(
e
)
{
self
.
options
.
localVideoStream
=
e
;
console
.
log
(
"local video ready"
);},
onerror
:
function
(
e
)
{
console
.
error
(
"local video error!"
);}
onerror
:
function
(
e
)
{
console
.
error
(
"local video error!"
,
e
);}
});
}
...
...
@@ -477,6 +479,8 @@
video
:
mediaParams
.
video
},
video
:
mediaParams
.
useVideo
,
useCameraLabel
:
self
.
options
.
useCameraLabel
,
useMicLabel
:
self
.
options
.
useMicLabel
,
onsuccess
:
onSuccess
,
onerror
:
onError
});
...
...
@@ -504,7 +508,7 @@
if
(
obj
.
options
.
useMic
!==
"any"
)
{
//audio.optional = [{sourceId: obj.options.useMic}];
audio
.
deviceId
=
{
exact
:
obj
.
options
.
useMic
}
;
audio
.
deviceId
=
assignMediaIdToConstraint
(
obj
.
options
.
useMic
)
;
}
}
...
...
@@ -514,9 +518,11 @@
audio
:
false
,
video
:
{
deviceId
:
obj
.
options
.
useCamera
},
},
localVideo
:
obj
.
options
.
localVideo
,
localVideo
:
obj
.
options
.
localVideo
,
useCameraLabel
:
obj
.
options
.
useCameraLabel
,
useMicLabel
:
obj
.
options
.
useMicLabel
,
onsuccess
:
function
(
e
)
{
obj
.
options
.
localVideoStream
=
e
;
console
.
log
(
"local video ready"
);},
onerror
:
function
(
e
)
{
console
.
error
(
"local video error!"
);
}
onerror
:
function
(
e
)
{
console
.
error
(
"local video error!"
,
e
);
}
});
}
...
...
@@ -571,9 +577,7 @@
if
(
obj
.
options
.
useCamera
!==
"any"
)
{
//video.optional.push({sourceId: obj.options.useCamera});
video
.
deviceId
=
{
exact
:
obj
.
options
.
useCamera
,
};
video
=
assignMediaIdToConstraint
(
obj
.
options
.
useCamera
,
video
);
}
if
(
bestFrameRate
)
{
...
...
@@ -661,7 +665,6 @@
onSuccess
(
self
.
options
.
useStream
);
}
else
if
(
mediaParams
.
audio
||
mediaParams
.
video
)
{
getUserMedia
({
constraints
:
{
audio
:
mediaParams
.
audio
,
...
...
@@ -669,7 +672,9 @@
},
video
:
mediaParams
.
useVideo
,
onsuccess
:
onSuccess
,
onerror
:
onError
onerror
:
onError
,
useCameraLabel
:
self
.
options
.
useCameraLabel
,
useMicLabel
:
self
.
options
.
useMicLabel
,
});
}
else
{
...
...
@@ -977,32 +982,77 @@
el
.
style
.
display
=
'none'
;
}
function
getUserMedia
(
options
)
{
var
n
=
navigator
,
media
;
n
.
getMedia
=
n
.
getUserMedia
;
n
.
getMedia
(
options
.
constraints
||
{
audio
:
true
,
video
:
video_constraints
},
streaming
,
options
.
onerror
||
function
(
e
)
{
console
.
error
(
e
);
});
function
assureConstraintByLabel
(
constraint
,
fallbackLabel
)
{
if
(
fallbackLabel
===
undefined
&&
constraint
===
undefined
)
{
return
Promise
.
resolve
(
constraint
);
}
if
(
typeof
(
assureMediaInputId
)
!==
'function'
)
{
console
.
warn
(
'Tried to use constraint fallbacks but did not found vendor function `assureMediaInputId` on window scope. Did you forget to import `vendor/media-device-id.js` before Verto?'
);
return
Promise
.
resolve
(
constraint
);
}
if
(
typeof
(
constraint
)
===
'object'
&&
!
constraint
.
deviceId
)
{
return
Promise
.
resolve
(
constraint
);
}
if
(
constraint
.
deviceId
)
{
if
(
typeof
(
constraint
.
deviceId
)
===
'string'
)
{
return
new
Promise
(
function
(
resolve
)
{
assureMediaInputId
(
fallbackLabel
,
constraint
.
deviceId
).
then
(
function
(
id
)
{
resolve
(
Object
.
assign
({},
constraint
,
{
deviceId
:
id
}));
}).
catch
(
function
()
{
resolve
(
constraint
);
});
});
}
if
(
typeof
(
constraint
.
deviceId
)
===
'object'
&&
typeof
(
constraint
.
deviceId
.
exact
)
===
'string'
)
{
return
new
Promise
(
function
(
resolve
)
{
assureMediaInputId
(
fallbackLabel
,
constraint
.
deviceId
.
exact
).
then
(
function
(
id
)
{
resolve
(
assignMediaIdToConstraint
(
id
,
constraint
));
}).
catch
(
function
()
{
resolve
(
constraint
);
});
});
}
}
return
Promise
.
resolve
(
constraint
);
}
function
streaming
(
stream
)
{
function
trustyGetUserMedia
(
options
,
constraints
)
{
navigator
.
mediaDevices
.
getUserMedia
(
constraints
).
then
(
function
(
stream
)
{
if
(
options
.
localVideo
)
{
activateLocalVideo
(
options
.
localVideo
,
stream
);
activateLocalVideo
(
options
.
localVideo
,
stream
);
}
if
(
options
.
onsuccess
)
{
options
.
onsuccess
(
stream
);
}
}).
catch
(
options
.
onerror
||
function
(
e
)
{
console
.
error
(
e
);
});
}
media
=
stream
;
}
function
assignMediaIdToConstraint
(
mediaId
,
rest
)
{
return
Object
.
assign
({},
rest
||
{},
{
deviceId
:
{
exact
:
mediaId
}
});
}
return
media
;
function
getUserMedia
(
options
)
{
var
constraints
=
options
.
constraints
||
{
audio
:
true
,
video
:
video_constraints
,
};
Promise
.
all
([
assureConstraintByLabel
(
constraints
.
audio
,
options
.
useMicLabel
),
assureConstraintByLabel
(
constraints
.
video
,
options
.
useCameraLabel
),
]).
then
(
function
(
assurances
)
{
trustyGetUserMedia
(
options
,
{
audio
:
assurances
[
0
],
video
:
assurances
[
1
]
});
}).
catch
(
function
(
error
)
{
console
.
error
(
'Unexpected error on media id assurance attempts:'
,
error
,
'Options:'
,
options
);
});
}
$
.
FSRTC
.
resSupported
=
function
(
w
,
h
)
{
...
...
@@ -1056,9 +1106,7 @@
};
if
(
cam
!==
"any"
)
{
video
.
deviceId
=
{
exact
:
cam
,
};
video
=
assignMediaIdToConstraint
(
cam
,
video
);
}
getUserMedia
({
...
...
html5/verto/js/src/jquery.verto.js
浏览文件 @
5075e544
...
...
@@ -462,6 +462,7 @@
if
(
args
[
"useCamera"
])
{
verto
.
options
.
deviceParams
[
"useCamera"
]
=
args
[
"useCamera"
];
verto
.
options
.
deviceParams
[
"useCameraLabel"
]
=
args
[
"useCameraLabel"
];
}
var
dialog
=
new
$
.
verto
.
dialog
(
$
.
verto
.
enum
.
direction
.
outbound
,
this
,
args
);
...
...
@@ -1938,6 +1939,7 @@
screenShare
:
false
,
useCamera
:
false
,
useMic
:
verto
.
options
.
deviceParams
.
useMic
,
useMicLabel
:
verto
.
options
.
deviceParams
.
useMicLabel
,
useSpeak
:
verto
.
options
.
deviceParams
.
useSpeak
,
tag
:
verto
.
options
.
tag
,
localTag
:
verto
.
options
.
localTag
,
...
...
@@ -1949,6 +1951,7 @@
if
(
!
dialog
.
params
.
screenShare
)
{
dialog
.
params
.
useCamera
=
verto
.
options
.
deviceParams
.
useCamera
;
dialog
.
params
.
useCameraLabel
=
verto
.
options
.
deviceParams
.
useCameraLabel
;
}
dialog
.
verto
=
verto
;
...
...
@@ -1960,7 +1963,9 @@
dialog
.
attach
=
params
.
attach
||
false
;
dialog
.
screenShare
=
params
.
screenShare
||
false
;
dialog
.
useCamera
=
dialog
.
params
.
useCamera
;
dialog
.
useCameraLabel
=
dialog
.
params
.
useCameraLabel
;
dialog
.
useMic
=
dialog
.
params
.
useMic
;
dialog
.
useMicLabel
=
dialog
.
params
.
useMicLabel
;
dialog
.
useSpeak
=
dialog
.
params
.
useSpeak
;
if
(
dialog
.
params
.
callID
)
{
...
...
@@ -2099,7 +2104,9 @@
iceServers
:
verto
.
options
.
iceServers
,
screenShare
:
dialog
.
screenShare
,
useCamera
:
dialog
.
useCamera
,
useCameraLabel
:
dialog
.
useCameraLabel
,
useMic
:
dialog
.
useMic
,
useMicLabel
:
dialog
.
useMicLabel
,
useSpeak
:
dialog
.
useSpeak
,
turnServer
:
verto
.
options
.
turnServer
,
useStream
:
dialog
.
params
.
useStream
...
...
@@ -2551,11 +2558,13 @@
dialog
.
params
.
callee_id_number
=
params
.
callee_id_number
;
if
(
params
.
useCamera
)
{
dialog
.
useCamera
=
params
.
useCamera
;
dialog
.
useCamera
=
params
.
useCamera
;
dialog
.
useCameraLabel
=
params
.
useCameraLabel
;
}
if
(
params
.
useMic
)
{
dialog
.
useMic
=
params
.
useMic
;
dialog
.
useMic
=
params
.
useMic
;
dialog
.
useMic
=
params
.
useMicLabel
;
}
if
(
params
.
useSpeak
)
{
...
...
html5/verto/js/src/vendor/media-device-id.min.js
0 → 100644
浏览文件 @
5075e544
This diff was suppressed by a .gitattributes entry.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论