Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
0322da07
提交
0322da07
authored
3月 24, 2015
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add local mute to verto
上级
a8bb1ca2
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
177 行增加
和
63 行删除
+177
-63
verto-min.js
html5/verto/demo/js/verto-min.js
+0
-0
jquery.FSRTC.js
html5/verto/js/src/jquery.FSRTC.js
+167
-63
jquery.verto.js
html5/verto/js/src/jquery.verto.js
+10
-0
没有找到文件。
html5/verto/demo/js/verto-min.js
浏览文件 @
0322da07
This diff was suppressed by a .gitattributes entry.
html5/verto/js/src/jquery.FSRTC.js
浏览文件 @
0322da07
...
...
@@ -77,6 +77,9 @@
useVideo
:
null
,
useStereo
:
false
,
userData
:
null
,
localVideo
:
null
,
screenShare
:
false
,
useCamera
:
"any"
,
iceServers
:
false
,
videoParams
:
{},
audioParams
:
{},
...
...
@@ -84,9 +87,11 @@
onICEComplete
:
function
()
{},
onICE
:
function
()
{},
onOfferSDP
:
function
()
{}
}
}
,
},
options
);
this
.
enabled
=
true
;
this
.
mediaData
=
{
SDP
:
null
,
profile
:
{},
...
...
@@ -118,11 +123,12 @@
checkCompat
();
};
$
.
FSRTC
.
prototype
.
useVideo
=
function
(
obj
)
{
$
.
FSRTC
.
prototype
.
useVideo
=
function
(
obj
,
local
)
{
var
self
=
this
;
if
(
obj
)
{
self
.
options
.
useVideo
=
obj
;
self
.
options
.
localVideo
=
local
;
if
(
moz
)
{
self
.
constraints
.
offerToReceiveVideo
=
true
;
}
else
{
...
...
@@ -130,6 +136,7 @@
}
}
else
{
self
.
options
.
useVideo
=
null
;
self
.
options
.
localVideo
=
null
;
if
(
moz
)
{
self
.
constraints
.
offerToReceiveVideo
=
false
;
}
else
{
...
...
@@ -196,8 +203,9 @@
doCallback
(
self
,
"onError"
,
e
);
}
function
onStreamSuccess
(
self
)
{
function
onStreamSuccess
(
self
,
stream
)
{
console
.
log
(
"Stream Success"
);
doCallback
(
self
,
"onStream"
,
stream
);
}
function
onICE
(
self
,
candidate
)
{
...
...
@@ -281,6 +289,7 @@
if
(
self
.
options
.
useVideo
)
{
self
.
options
.
useVideo
.
style
.
display
=
'none'
;
self
.
options
.
useVideo
[
moz
?
'mozSrcObject'
:
'src'
]
=
""
;
}
if
(
self
.
localStream
)
{
...
...
@@ -288,17 +297,58 @@
self
.
localStream
=
null
;
}
if
(
self
.
options
.
localVideo
)
{
self
.
options
.
localVideo
.
style
.
display
=
'none'
;
self
.
options
.
localVideo
[
moz
?
'mozSrcObject'
:
'src'
]
=
""
;
}
if
(
self
.
options
.
localVideoStream
)
{
self
.
options
.
localVideoStream
.
stop
();
}
if
(
self
.
peer
)
{
console
.
log
(
"stopping peer"
);
self
.
peer
.
stop
();
}
};
$
.
FSRTC
.
prototype
.
createAnswer
=
function
(
sdp
)
{
$
.
FSRTC
.
prototype
.
getMute
=
function
()
{
var
self
=
this
;
return
self
.
enabled
;
}
$
.
FSRTC
.
prototype
.
setMute
=
function
(
what
)
{
var
self
=
this
;
var
audioTracks
=
self
.
localStream
.
getAudioTracks
();
for
(
var
i
=
0
,
len
=
audioTracks
.
length
;
i
<
len
;
i
++
)
{
switch
(
what
)
{
case
"on"
:
audioTracks
[
i
].
enabled
=
true
;
break
;
case
"off"
:
audioTracks
[
i
].
enabled
=
false
;
break
;
case
"toggle"
:
audioTracks
[
i
].
enabled
=
!
audioTracks
[
i
].
enabled
;
default
:
break
;
}
self
.
enabled
=
audioTracks
[
i
].
enabled
;
}
return
!
self
.
enabled
;
}
$
.
FSRTC
.
prototype
.
createAnswer
=
function
(
params
)
{
var
self
=
this
;
self
.
type
=
"answer"
;
self
.
remoteSDP
=
sdp
;
console
.
debug
(
"inbound sdp: "
,
sdp
);
self
.
remoteSDP
=
params
.
sdp
;
console
.
debug
(
"inbound sdp: "
,
params
.
sdp
);
self
.
options
.
useCamera
=
params
.
useCamera
||
"any"
;
self
.
options
.
useMic
=
params
.
useMic
||
"any"
;
function
onSuccess
(
stream
)
{
self
.
localStream
=
stream
;
...
...
@@ -336,53 +386,117 @@
onStreamError
(
self
,
e
);
}
var
mediaParams
=
getMediaParams
(
self
);
console
.
log
(
"Audio constraints"
,
mediaParams
.
audio
);
console
.
log
(
"Video constraints"
,
mediaParams
.
video
);
if
(
self
.
options
.
useVideo
&&
self
.
options
.
localVideo
)
{
getUserMedia
({
constraints
:
{
audio
:
false
,
video
:
{
mandatory
:
self
.
options
.
videoParams
,
optional
:
[]
},
},
localVideo
:
self
.
options
.
localVideo
,
onsuccess
:
function
(
e
)
{
self
.
options
.
localVideoStream
=
e
;
console
.
log
(
"local video ready"
);},
onerror
:
function
(
e
)
{
console
.
error
(
"local video error!"
);}
});
}
getUserMedia
({
constraints
:
{
audio
:
mediaParams
.
audio
,
video
:
mediaParams
.
video
},
video
:
mediaParams
.
useVideo
,
onsuccess
:
onSuccess
,
onerror
:
onError
});
};
function
getMediaParams
(
obj
)
{
var
audio
;
if
(
this
.
options
.
videoParams
&&
this
.
options
.
videoParams
.
chromeMediaSource
==
'screen
'
)
{
if
(
obj
.
options
.
videoParams
&&
obj
.
options
.
screenShare
)
{
//obj.options.videoParams.chromeMediaSource == 'desktop
') {
this
.
options
.
videoParams
=
{
chromeMediaSource
:
'screen'
,
maxWidth
:
screen
.
width
,
maxHeight
:
screen
.
height
};
//obj.options.videoParams = {
// chromeMediaSource: 'screen',
// maxWidth:screen.width,
// maxHeight:screen.height
// chromeMediaSourceId = sourceId;
// };
console
.
error
(
"SCREEN SHARE"
);
audio
=
false
;
}
else
{
audio
=
{
mandatory
:
this
.
options
.
audioParams
,
mandatory
:
obj
.
options
.
audioParams
,
optional
:
[]
};
if
(
obj
.
options
.
useMic
!==
"any"
)
{
audio
.
optional
=
[{
sourceId
:
obj
.
options
.
useMic
}]
}
}
console
.
log
(
"Mandatory audio constraints"
,
this
.
options
.
audioParams
);
console
.
log
(
"Mandatory video constraints"
,
this
.
options
.
videoParams
);
if
(
obj
.
options
.
useVideo
&&
obj
.
options
.
localVideo
)
{
getUserMedia
({
constraints
:
{
audio
:
false
,
video
:
{
mandatory
:
obj
.
options
.
videoParams
,
optional
:
[]
},
},
localVideo
:
obj
.
options
.
localVideo
,
onsuccess
:
function
(
e
)
{
self
.
options
.
localVideoStream
=
e
;
console
.
log
(
"local video ready"
);},
onerror
:
function
(
e
)
{
console
.
error
(
"local video error!"
);}
});
}
getUserMedia
({
constraints
:
{
audio
:
audio
,
video
:
this
.
options
.
useVideo
?
{
mandatory
:
this
.
options
.
videoParams
,
optional
:
[]
}
:
null
},
video
:
this
.
options
.
useVideo
?
true
:
false
,
onsuccess
:
onSuccess
,
onerror
:
onError
});
var
video
=
{
mandatory
:
obj
.
options
.
videoParams
,
optional
:
[]
}
var
useVideo
=
obj
.
options
.
useVideo
;
if
(
useVideo
&&
obj
.
options
.
useCamera
&&
obj
.
options
.
useCamera
!==
"none"
)
{
if
(
obj
.
options
.
useCamera
!==
"any"
)
{
video
.
optional
=
[{
sourceId
:
obj
.
options
.
useCamera
}]
}
}
else
{
video
=
null
;
useVideo
=
null
;
}
return
{
audio
:
audio
,
video
:
video
,
useVideo
:
useVideo
};
}
};
$
.
FSRTC
.
prototype
.
call
=
function
(
profile
)
{
checkCompat
();
var
self
=
this
;
var
screen
=
false
;
self
.
type
=
"offer"
;
if
(
self
.
options
.
videoParams
&&
self
.
options
.
screenShare
)
{
//self.options.videoParams.chromeMediaSource == 'desktop') {
screen
=
true
;
}
function
onSuccess
(
stream
)
{
self
.
localStream
=
stream
;
self
.
localStream
=
stream
;
self
.
peer
=
RTCPeerConnection
({
type
:
self
.
type
,
...
...
@@ -393,7 +507,7 @@
onICEComplete
:
function
()
{
return
onICEComplete
(
self
);
},
onRemoteStream
:
function
(
stream
)
{
onRemoteStream
:
screen
?
function
(
stream
)
{
console
.
error
(
"SKIP"
);}
:
function
(
stream
)
{
return
onRemoteStream
(
self
,
stream
);
},
onOfferSDP
:
function
(
sdp
)
{
...
...
@@ -409,53 +523,35 @@
iceServers
:
self
.
options
.
iceServers
,
});
onStreamSuccess
(
self
);
onStreamSuccess
(
self
,
stream
);
}
function
onError
(
e
)
{
onStreamError
(
self
,
e
);
}
var
mediaParams
=
getMediaParams
(
self
);
var
audio
;
if
(
this
.
options
.
videoParams
&&
this
.
options
.
videoParams
.
chromeMediaSource
==
'screen'
)
{
this
.
options
.
videoParams
=
{
chromeMediaSource
:
'screen'
,
maxWidth
:
screen
.
width
,
maxHeight
:
screen
.
height
};
console
.
error
(
"SCREEN SHARE"
);
audio
=
false
;
}
else
{
audio
=
{
mandatory
:
this
.
options
.
audioParams
,
optional
:
[]
};
}
console
.
log
(
"Mandatory audio constraints"
,
this
.
options
.
audioParams
);
console
.
log
(
"Mandatory video constraints"
,
this
.
options
.
videoParams
);
console
.
log
(
"Audio constraints"
,
mediaParams
.
audio
);
console
.
log
(
"Video constraints"
,
mediaParams
.
video
);
getUserMedia
({
constraints
:
{
audio
:
audio
,
video
:
this
.
options
.
useVideo
?
{
mandatory
:
this
.
options
.
videoParams
,
optional
:
[]
}
:
null
audio
:
mediaParams
.
audio
,
video
:
mediaParams
.
video
},
video
:
this
.
options
.
useVideo
?
true
:
false
,
video
:
mediaParams
.
useVideo
,
onsuccess
:
onSuccess
,
onerror
:
onError
});
/*
navigator.getUserMedia({
video:
this
.options.useVideo,
video:
self
.options.useVideo,
audio: true
}, onSuccess, onError);
*/
...
...
@@ -823,14 +919,22 @@
});
function
streaming
(
stream
)
{
var
video
=
options
.
video
;
if
(
video
)
{
video
[
moz
?
'mozSrcObject'
:
'src'
]
=
moz
?
stream
:
window
.
webkitURL
.
createObjectURL
(
stream
);
//var video = options.video;
//var localVideo = options.localVideo;
//if (video) {
// video[moz ? 'mozSrcObject' : 'src'] = moz ? stream : window.webkitURL.createObjectURL(stream);
//video.play();
//}
if
(
options
.
localVideo
)
{
options
.
localVideo
[
moz
?
'mozSrcObject'
:
'src'
]
=
moz
?
stream
:
window
.
webkitURL
.
createObjectURL
(
stream
);
options
.
localVideo
.
style
.
display
=
'block'
;
}
if
(
options
.
onsuccess
)
{
options
.
onsuccess
(
stream
);
}
media
=
stream
;
}
...
...
html5/verto/js/src/jquery.verto.js
浏览文件 @
0322da07
...
...
@@ -1726,6 +1726,16 @@
};
$
.
verto
.
dialog
.
prototype
.
setMute
=
function
(
what
)
{
var
dialog
=
this
;
return
dialog
.
rtc
.
setMute
(
what
);
};
$
.
verto
.
dialog
.
prototype
.
getMute
=
function
(
what
)
{
var
dialog
=
this
;
return
dialog
.
rtc
.
getMute
(
what
);
};
$
.
verto
.
dialog
.
prototype
.
useStereo
=
function
(
on
)
{
var
dialog
=
this
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论