Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
045550b0
提交
045550b0
authored
8月 28, 2015
作者:
Joao Mesquita
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-8043: [verto_communicator] Adjust to improved verto API and refactor how we select cameras
上级
3850e467
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
126 行增加
和
130 行删除
+126
-130
vertoService.js
...to_communicator/src/vertoService/services/vertoService.js
+126
-130
没有找到文件。
html5/verto/verto_communicator/src/vertoService/services/vertoService.js
浏览文件 @
045550b0
...
...
@@ -110,6 +110,7 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
videoDevices
:
[],
audioDevices
:
[],
shareDevices
:
[],
videoQuality
:
[],
extension
:
$cookieStore
.
get
(
'verto_demo_ext'
),
name
:
$cookieStore
.
get
(
'verto_demo_name'
),
email
:
$cookieStore
.
get
(
'verto_demo_email'
),
...
...
@@ -155,34 +156,34 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
$rootScope
.
$emit
(
'call.incoming'
,
number
);
}
function
getVideoParams
(
)
{
var
maxWidth
,
maxHeight
;
function
updateResolutions
(
supportedResolutions
)
{
console
.
debug
(
'Attempting to sync supported and available resolutions'
)
;
maxWidth
=
data
.
bestWidth
;
maxHeight
=
data
.
bestHeight
;
var
removed
=
0
;
if
(
!
data
.
bestWidth
)
{
if
(
videoResolution
[
data
.
vidQual
])
{
maxWidth
=
videoResolution
[
data
.
vidQual
].
width
;
}
}
angular
.
forEach
(
videoQuality
,
function
(
resolution
,
id
)
{
var
supported
=
false
;
angular
.
forEach
(
supportedResolutions
,
function
(
res
)
{
var
width
=
res
[
0
];
var
height
=
res
[
1
];
if
(
resolution
.
width
==
width
&&
resolution
.
height
==
height
)
{
supported
=
true
;
}
});
if
(
!
data
.
bestHeight
)
{
if
(
videoResolution
[
data
.
vidQual
])
{
maxHeight
=
videoResolution
[
data
.
vidQual
].
height
;
if
(
!
supported
)
{
delete
videoQuality
[
id
];
++
removed
;
}
}
}
);
return
{
minWidth
:
videoResolution
[
data
.
vidQual
].
width
,
minHeight
:
videoResolution
[
data
.
vidQual
].
height
,
maxWidth
:
maxWidth
,
maxHeight
:
maxHeight
,
minFrameRate
:
15
,
vertoBestFrameRate
:
30
videoQuality
.
length
=
videoQuality
.
length
-
removed
;
data
.
videoQuality
=
videoQuality
;
data
.
vidQual
=
(
videoQuality
.
length
>
0
)
?
videoQuality
[
videoQuality
.
length
-
1
].
id
:
null
;
}
;
}
return
videoQuality
;
}
;
var
callState
=
{
muteMic
:
false
,
...
...
@@ -199,118 +200,122 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
videoResolution
:
videoResolution
,
bandwidth
:
bandwidth
,
refreshDevices
:
function
(
callback
)
{
console
.
debug
(
'Attempting to refresh the devices.'
);
function
refreshDevicesCallback
()
{
data
.
videoDevices
=
[{
id
:
'none'
,
label
:
'No camera'
}];
data
.
shareDevices
=
[{
id
:
'screen'
,
label
:
'Screen'
}];
data
.
audioDevices
=
[];
for
(
var
i
in
jQuery
.
verto
.
videoDevices
)
{
var
device
=
jQuery
.
verto
.
videoDevices
[
i
];
if
(
!
device
.
label
)
{
data
.
videoDevices
.
push
({
id
:
'Camera '
+
i
,
label
:
'Camera '
+
i
});
}
else
{
data
.
videoDevices
.
push
({
id
:
device
.
id
,
label
:
device
.
label
||
device
.
id
});
}
// Selecting the first source.
if
(
i
==
0
)
{
data
.
selectedVideo
=
device
.
id
;
}
refreshDevicesCallback
:
function
refreshDevicesCallback
()
{
data
.
videoDevices
=
[];
data
.
shareDevices
=
[{
id
:
'screen'
,
label
:
'Screen'
}];
data
.
audioDevices
=
[];
for
(
var
i
in
jQuery
.
verto
.
videoDevices
)
{
var
device
=
jQuery
.
verto
.
videoDevices
[
i
];
if
(
!
device
.
label
)
{
data
.
videoDevices
.
push
({
id
:
'Camera '
+
i
,
label
:
'Camera '
+
i
});
}
else
{
data
.
videoDevices
.
push
({
id
:
device
.
id
,
label
:
device
.
label
||
device
.
id
});
}
if
(
!
device
.
label
)
{
data
.
shareDevices
.
push
({
id
:
'Share Device '
+
i
,
label
:
'Share Device '
+
i
});
continue
;
}
// Selecting the first source.
if
(
i
==
0
)
{
storage
.
data
.
selectedVideo
=
device
.
id
;
}
if
(
!
device
.
label
)
{
data
.
shareDevices
.
push
({
id
:
device
.
id
,
label
:
device
.
label
||
device
.
id
id
:
'Share Device '
+
i
,
label
:
'Share Device '
+
i
});
continue
;
}
for
(
var
i
in
jQuery
.
verto
.
audioInDevices
)
{
var
device
=
jQuery
.
verto
.
audioInDevices
[
i
];
// Selecting the first source.
if
(
i
==
0
)
{
data
.
selectedAudio
=
device
.
id
;
}
data
.
shareDevices
.
push
({
id
:
device
.
id
,
label
:
device
.
label
||
device
.
id
});
}
if
(
!
device
.
label
)
{
data
.
audioDevices
.
push
({
id
:
'Microphone '
+
i
,
label
:
'Microphone '
+
i
});
continue
;
}
for
(
var
i
in
jQuery
.
verto
.
audioInDevices
)
{
var
device
=
jQuery
.
verto
.
audioInDevices
[
i
];
// Selecting the first source.
if
(
i
==
0
)
{
storage
.
data
.
selectedAudio
=
device
.
id
;
}
if
(
!
device
.
label
)
{
data
.
audioDevices
.
push
({
id
:
device
.
id
,
label
:
device
.
label
||
device
.
id
id
:
'Microphone '
+
i
,
label
:
'Microphone '
+
i
});
continue
;
}
console
.
debug
(
'Devices were refreshed.'
);
};
jQuery
.
verto
.
refreshDevices
(
refreshDevicesCallback
);
data
.
audioDevices
.
push
({
id
:
device
.
id
,
label
:
device
.
label
||
device
.
id
});
}
console
.
debug
(
'Devices were refreshed, checking that we have cameras.'
);
// This means that we cannot use video!
if
(
data
.
videoDevices
.
length
===
0
)
{
console
.
log
(
'No camera, disabling video.'
);
data
.
canVideo
=
false
;
data
.
videoDevices
.
push
({
id
:
'none'
,
label
:
'No camera'
});
}
else
{
data
.
canVideo
=
true
;
}
},
refreshDevices
:
function
(
callback
)
{
console
.
debug
(
'Attempting to refresh the devices.'
);
jQuery
.
verto
.
refreshDevices
(
this
.
refreshDevicesCallback
);
},
/**
* Updates the video resolutions based on settings.
*/
refreshVideoResolution
:
function
()
{
refreshVideoResolution
:
function
(
resolutions
)
{
console
.
debug
(
'Attempting to refresh video resolutions.'
);
if
(
data
.
instance
)
{
data
.
instance
.
videoParams
(
getVideoParams
());
}
else
{
console
.
debug
(
'There is no instance of verto.'
);
}
},
updateResolutions
:
function
(
supportedResolutions
)
{
console
.
debug
(
'Attempting to sync supported and available resolutions'
);
var
removed
=
0
;
var
w
=
resolutions
[
'bestResSupported'
][
0
];
var
h
=
resolutions
[
'bestResSupported'
][
1
];
angular
.
forEach
(
videoQuality
,
function
(
resolution
,
id
)
{
var
supported
=
false
;
angular
.
forEach
(
supportedResolutions
,
function
(
res
)
{
var
width
=
res
[
0
];
var
height
=
res
[
1
];
if
(
h
===
1080
)
{
w
=
1280
;
h
=
720
;
}
if
(
resolution
.
width
==
width
&&
resolution
.
height
==
height
)
{
supported
=
true
;
}
updateResolutions
(
resolutions
[
'validRes'
]);
data
.
instance
.
videoParams
({
minWidth
:
w
,
minHeight
:
h
,
maxWidth
:
w
,
maxHeight
:
h
,
minFrameRate
:
15
,
vertoBestFrameRate
:
30
});
videoQuality
.
forEach
(
function
(
qual
){
if
(
w
===
qual
.
width
&&
h
===
qual
.
height
)
{
if
(
storage
.
data
.
vidQual
!==
qual
.
id
)
{
storage
.
data
.
vidQual
=
qual
.
id
;
}
}
if
(
!
supported
)
{
delete
videoQuality
[
id
];
++
removed
;
}
});
videoQuality
.
length
=
videoQuality
.
length
-
removed
;
this
.
videoQuality
=
videoQuality
;
this
.
data
.
vidQual
=
(
videoQuality
.
length
>
0
)
?
videoQuality
[
videoQuality
.
length
-
1
].
id
:
null
;
});
return
videoQuality
;
}
else
{
console
.
debug
(
'There is no instance of verto.'
);
}
},
/**
...
...
@@ -502,24 +507,11 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
}
};
var
init
=
function
(
resolutions
)
{
// This means that we cannot use video!
if
(
resolutions
.
validRes
.
length
===
0
)
{
console
.
log
(
'No valid resolutions, disabling video.'
);
data
.
canVideo
=
false
;
}
else
{
data
.
canVideo
=
true
;
}
data
.
bestWidth
=
resolutions
[
'bestResSupported'
][
0
];
data
.
bestHeight
=
resolutions
[
'bestResSupported'
][
1
];
if
(
data
.
canVideo
)
{
that
.
updateResolutions
(
resolutions
[
'validRes'
]);
that
.
refreshVideoResolution
();
}
var
that
=
this
;
function
ourBootstrap
()
{
// Checking if we have a failed connection attempt before
// connecting again.
that
.
refreshDevicesCallback
();
if
(
data
.
instance
&&
!
data
.
instance
.
rpcClient
.
socketReady
())
{
clearTimeout
(
data
.
instance
.
rpcClient
.
to
);
data
.
instance
.
logout
();
...
...
@@ -530,7 +522,6 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
socketUrl
:
data
.
wsURL
,
tag
:
"webcam"
,
ringFile
:
"sounds/bell_ring2.wav"
,
videoParams
:
getVideoParams
(),
// TODO: Add options for this.
audioParams
:
{
googEchoCancellation
:
storage
.
data
.
googEchoCancellation
||
false
,
...
...
@@ -540,10 +531,15 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
iceServers
:
data
.
useSTUN
},
callbacks
);
that
.
refreshDevices
();
};
data
.
instance
.
deviceParams
({
useCamera
:
storage
.
data
.
selectedVideo
,
useMic
:
storage
.
data
.
selectedAudio
,
resCheck
:
that
.
refreshVideoResolution
});
}
jQuery
.
verto
.
init
({},
init
);
$
.
verto
.
init
({},
ourBootstrap
);
},
/**
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论