提交 6d6bd1ef authored 作者: Anthony Minessale's avatar Anthony Minessale

FS-9242 convert to adapter.js

上级 0e6e53f1
JSFILES=src/jquery.FSRTC.js src/jquery.jsonrpcclient.js src/jquery.verto.js
JSFILES=src/jquery.FSRTC.js src/jquery.jsonrpcclient.js src/jquery.verto.js src/vendor/adapter-latest.js
all: jsmin verto-min.js
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -108,6 +108,7 @@
<script type="text/javascript" src="../js/src/jquery.jsonrpcclient.js"></script>
<script type="text/javascript" src="../js/src/jquery.FSRTC.js"></script>
<script type="text/javascript" src="../js/src/jquery.verto.js"></script>
<script type="text/javascript" src="../js/src/vendor/adapter-latest.js"></script>
<script type="text/javascript" src="js/3rd-party/getScreenId.js"></script>
<script type="text/javascript" src="js/3rd-party/md5.min.js"></script>
......
......@@ -7,7 +7,7 @@
<div class="panel-body">
<div class="preview-wrapper">
<video id="videopreview" muted autoplay style="width: 100%;"></video>
<div id="mic-meter">
<div id="mic-meter" ng-if="audioContext">
<div class="volumes">
<div class="volume-segment"></div>
<div class="volume-segment"></div>
......
......@@ -14,11 +14,7 @@
'status': 'success',
'message': $translate.instant('BROWSER_COMPATIBILITY')
};
navigator.getUserMedia = navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia;
if (!navigator.getUserMedia) {
if (!navigator.mediaDevices.getUserMedia) {
result['status'] = 'error';
result['message'] = $translate.instant('BROWSER_WITHOUT_WEBRTC');
reject(result);
......
......@@ -23,6 +23,7 @@
mutedMic: false,
preview: true,
selectedVideo: null,
selectedVideoName: null,
selectedAudio: null,
selectedShare: null,
selectedSpeaker: null,
......
......@@ -4,8 +4,8 @@
angular
.module('vertoControllers')
.controller('DialPadController', ['$rootScope', '$scope',
'$http', '$location', 'toastr', 'verto', 'storage', 'CallHistory', 'eventQueue',
function($rootScope, $scope, $http, $location, toastr, verto, storage, CallHistory, eventQueue) {
'$http', '$location', 'toastr', 'verto', 'storage', 'CallHistory', 'eventQueue', '$timeout',
function($rootScope, $scope, $http, $location, toastr, verto, storage, CallHistory, eventQueue, $timeout) {
console.debug('Executing DialPadController.');
eventQueue.process();
......
......@@ -11,7 +11,10 @@
$scope.storage = storage;
console.debug('Executing PreviewController.');
var localVideo = document.getElementById('videopreview');
var volumes = document.querySelector('#mic-meter .volumes').children;
var volumes = document.querySelector('#mic-meter .volumes');
if (volumes) {
volumes = volumes.children;
}
$scope.localVideo = function() {
var constraints = {
......@@ -31,10 +34,13 @@
});
};
var audioContext = null;
if (typeof AudioContext !== "undefined") {
audioContext = new AudioContext();
}
var audioContext = new AudioContext();
var mediaStreamSource = null;
var meter;
var meter = null;
var streamObj = {};
function stopMedia(stream) {
......@@ -55,13 +61,12 @@
}
streamObj = stream;
localVideo.src = window.URL.createObjectURL(stream);
mediaStreamSource = audioContext.createMediaStreamSource(stream);
meter = createAudioMeter(audioContext);
mediaStreamSource.connect(meter);
renderMic();
FSRTCattachMediaStream(localVideo, stream);
if (audioContext) {
mediaStreamSource = audioContext.createMediaStreamSource(stream);
meter = createAudioMeter(audioContext);
mediaStreamSource.connect(meter);
};
}
function renderMic() {
......@@ -109,8 +114,10 @@
$scope.endPreview = function() {
localVideo.src = null;
meter.shutdown();
meter.onaudioprocess = null;
if (audioContext) {
meter.shutdown();
meter.onaudioprocess = null;
};
stopMedia(streamObj);
$location.path('/dialpad');
storage.data.preview = false;
......
......@@ -33,6 +33,15 @@
});
$scope.ok = function() {
console.log('Camera Selected is', $scope.mydata.selectedVideo, $scope.verto.data.videoDevices);
angular.forEach(verto.data.videoDevices, function(video) {
console.log('checking video ', video);
if (video.id == $scope.mydata.selectedVideo) {
$scope.mydata.selectedVideoName = video.label;
console.log('Setting selectedVideoName to ', video.label);
}
})
if ($scope.mydata.selectedSpeaker != storage.data.selectedSpeaker) {
$rootScope.$emit('changedSpeaker', $scope.mydata.selectedSpeaker);
}
......
......@@ -74,7 +74,7 @@
$rootScope.$on('progress.complete', function(ev, current_progress) {
$scope.message = 'Complete';
if(verto.data.connected) {
if (storage.data.preview) {
if (0 && storage.data.preview) {
$location.path('/preview');
}
else {
......
......@@ -13,17 +13,35 @@
.module('vertoDirectives')
.directive('videoTag',
function() {
function link(scope, element, attrs) {
// Moving the video tag to the new place inside the incall page.
console.log('Moving the video to element.');
jQuery('video').removeClass('hide').appendTo(element);
jQuery('video').css('display', 'block');
var videoElem = jQuery('#webcam');
var newParent = document.getElementsByClassName('video-tag-wrapper');
newParent[0].appendChild(document.getElementById('webcam'));
$("#webcam").resize(function() {
updateVideoSize();
});
$(window).resize(function() {
updateVideoSize();
});
updateVideoSize();
videoElem.removeClass('hide');
videoElem.css('display', 'block');
scope.callActive("", {useVideo: true});
element.on('$destroy', function() {
// Move the video back to the body.
console.log('Moving the video back to body.');
jQuery('video').addClass('hide').appendTo(jQuery('body'));
videoElem.addClass('hide').appendTo(jQuery('body'));
$(window).unbind('resize');
});
}
......
......@@ -113,6 +113,35 @@ var framerate = [{
label: '30 FPS'
}, ];
var updateReq;
var updateVideoSize = function(ms) {
if (!ms) ms = 500;
clearTimeout(updateReq);
updateReq = setTimeout(function () {
var videoElem = jQuery('#webcam');
videoElem.width("");
videoElem.height("");
var w = videoElem.width();
var h = videoElem.height();
var new_w, new_h;
var aspect = 1920 / 1080;
var videoContainer = jQuery('div.video-wrapper');
if (w > h) {
new_w = videoContainer.width();
new_h = Math.round(videoContainer.width() / aspect);
} else {
new_h = videoContainer.height();
new_w = Math.round(videoContainer.height() / aspect);
}
videoElem.width(new_w);
videoElem.height(new_h);
console.log('Setting video size to ' + new_w + '/' + new_h);
}, ms);
}
var vertoService = angular.module('vertoService', ['ngCookies']);
vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'storage',
......@@ -317,7 +346,13 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
// Verify if selected devices are valid
var videoFlag = data.videoDevices.some(function(device) {
return device.id == storage.data.selectedVideo;
console.log('Evaluating device ', device);
if (device.label == storage.data.selectedVideoName) {
console.log('Matched video selection by name: ', device.label);
storage.data.selectedVideo = device.id;
return true;
}
return device.id == storage.data.selectedVideo && storage.data.selectedVideo !== "none";
});
var shareFlag = data.shareDevices.some(function(device) {
......@@ -332,7 +367,10 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
return device.id == storage.data.selectedSpeaker;
});
if (!videoFlag) storage.data.selectedVideo = data.videoDevices[0].id;
console.log('Storage Video: ', storage.data.selectedVideo);
console.log('Video Flag: ', videoFlag)
if (!videoFlag) storage.data.selectedVideo = data.videoDevices[data.videoDevices.length - 1].id;
if (!shareFlag) storage.data.selectedShare = data.shareDevices[0].id;
if (!audioFlag) storage.data.selectedAudio = data.audioDevices[0].id;
if (!speakerFlag && data.speakerDevices.length > 0) storage.data.selectedSpeaker = data.speakerDevices[0].id;
......@@ -484,7 +522,6 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
data.liveArray.onChange = function(obj, args) {
// console.log('liveArray.onChange', obj, args);
switch (args.action) {
case 'bootObj':
$rootScope.$emit('members.boot', args.data);
......@@ -560,6 +597,7 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
console.log("conference-liveArray-join");
stopConference();
startConference(v, dialog, params.pvtData);
updateVideoSize();
}
break;
case "conference-liveArray-part":
......@@ -616,6 +654,7 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
console.debug('Talking to:', d.cidString());
data.callState = 'active';
callActive(d.lastState.name, d.params);
updateVideoSize();
break;
case "hangup":
console.debug('Call ended with cause: ' + d.cause);
......
This diff was suppressed by a .gitattributes entry.
......@@ -101,14 +101,14 @@ function full_screen(name) {
}
$("#" + video_screen).resize(function(e) {
console.log("video size changed to " + $("#" + video_screen).width() + "x" + $("#" + video_screen).height());
//console.log("video size changed to " + $("#" + video_screen).width() + "x" + $("#" + video_screen).height());
if ($("#" + video_screen).width() > $(window).width()) {
//if ($("#" + video_screen).width() > $(window).width()) {
//resize(false);
$("#" + video_screen).width("100%");
$("#" + video_screen).height("100%");
}
//$("#" + video_screen).width("100%");
//$("#" + video_screen).height("100%");
//}
real_size();
});
......@@ -128,13 +128,41 @@ function resize(up) {
}
$( window ).resize(function() {
real_size();
});
function real_size() {
/* temasys hack */
setTimeout(function() {
$("#" + video_screen).width("");
$("#" + video_screen).height("");
$("#" + video_screen).width("");
$("#" + video_screen).height("");
var w = $("#" + video_screen).width();
var h = $("#" + video_screen).height();
var new_w;
var new_h;
var aspect = 1920 / 1080; /*temasys doesn't provide video width hack aspect to wide screen*/
if (w > h) {
new_w = window.innerWidth;
new_h = Math.round(window.innerWidth / aspect);
} else {
new_h = window.innerHeight;
new_w = Math.round(window.innerHeight / aspect);
}
$("#" + video_screen).width(new_w);
$("#" + video_screen).height(new_h);
}, 500);
console.log("video size changed to fit screen");
console.log("video size changed to natural default");
}
......@@ -202,8 +230,19 @@ function check_vid() {
return use_vid;
}
var DISABLE_SPEED_TEST = true;
function do_speed_test(fn)
{
if (DISABLE_SPEED_TEST) {
if (fn) {
fn();
}
return;
}
goto_page("bwtest");
vertoHandle.rpcClient.speedTest(1024 * 256, function(e, obj) {
......@@ -486,6 +525,7 @@ var callbacks = {
check_vid_res();
$("#ansbtn").click(function() {
console.error("WTF", cur_call, d);
cur_call.answer({
useStereo: $("#use_stereo").is(':checked'),
callee_id_name: $("#cidname").val(),
......@@ -548,7 +588,7 @@ var callbacks = {
}
goto_page("incall");
real_size();
break;
case $.verto.enum.state.hangup:
$("#main_info").html("Call ended with cause: " + d.cause);
......
......@@ -8074,7 +8074,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
if (switch_channel_test_flag(smh->session->channel, CF_ICE)) {
gen_ice(session, SWITCH_MEDIA_TYPE_AUDIO, ip, port);
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=msid-semantic: WMS %s\r\na=end-of-candidates\r\n", smh->msid);
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=msid-semantic: WMS %s\r\n", smh->msid);
}
if (a_engine->codec_negotiated) {
......@@ -8267,6 +8267,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
}
}
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=end-of-candidates\r\n");
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ssrc:%u cname:%s\r\n", a_engine->ssrc, smh->cname);
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ssrc:%u msid:%s a0\r\n", a_engine->ssrc, smh->msid);
......@@ -8804,6 +8805,8 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
#ifdef GOOGLE_ICE
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ice-options:google-ice\r\n");
#endif
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=end-of-candidates\r\n");
}
......
......@@ -3192,7 +3192,7 @@ static int do_dtls(switch_rtp_t *rtp_session, switch_dtls_t *dtls)
ret = SSL_get_error(dtls->ssl, ret);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "%s DTLS packet read err %d\n", rtp_type(rtp_session), ret);
}
if (dtls_states[dtls->state]) {
r = dtls_states[dtls->state](rtp_session, dtls);
}
......@@ -3396,8 +3396,11 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
//SSL_CTX_set_verify(dtls->ssl_ctx, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, NULL);
SSL_CTX_set_verify(dtls->ssl_ctx, SSL_VERIFY_NONE, NULL);
SSL_CTX_set_cipher_list(dtls->ssl_ctx, "ALL");
SSL_CTX_set_cipher_list(dtls->ssl_ctx, "ECDH:!RC4:!SSLv3:RSA_WITH_AES_128_CBC_SHA");
//SSL_CTX_set_cipher_list(dtls->ssl_ctx, "ECDHE-RSA-AES256-GCM-SHA384");
//SSL_CTX_set_cipher_list(dtls->ssl_ctx, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
//SSL_CTX_set_cipher_list(dtls->ssl_ctx, "SUITEB128");
SSL_CTX_set_read_ahead(dtls->ssl_ctx, 1);
#ifdef HAVE_OPENSSL_DTLS_SRTP
//SSL_CTX_set_tlsext_use_srtp(dtls->ssl_ctx, "SRTP_AES128_CM_SHA1_80:SRTP_AES128_CM_SHA1_32");
SSL_CTX_set_tlsext_use_srtp(dtls->ssl_ctx, "SRTP_AES128_CM_SHA1_80");
......@@ -3456,11 +3459,11 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
SSL_set_verify(dtls->ssl, SSL_VERIFY_NONE, NULL);
SSL_set_app_data(dtls->ssl, dtls);
BIO_ctrl(dtls->read_bio, BIO_CTRL_DGRAM_SET_MTU, 1400, NULL);
BIO_ctrl(dtls->write_bio, BIO_CTRL_DGRAM_SET_MTU, 1400, NULL);
SSL_set_mtu(dtls->ssl, 1400);
BIO_ctrl(dtls->write_bio, BIO_C_SET_BUFF_SIZE, 1400, NULL);
BIO_ctrl(dtls->read_bio, BIO_C_SET_BUFF_SIZE, 1400, NULL);
//BIO_ctrl(dtls->read_bio, BIO_CTRL_DGRAM_SET_MTU, 1400, NULL);
//BIO_ctrl(dtls->write_bio, BIO_CTRL_DGRAM_SET_MTU, 1400, NULL);
//SSL_set_mtu(dtls->ssl, 1400);
//BIO_ctrl(dtls->write_bio, BIO_C_SET_BUFF_SIZE, 1400, NULL);
//BIO_ctrl(dtls->read_bio, BIO_C_SET_BUFF_SIZE, 1400, NULL);
......@@ -4145,7 +4148,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_video_buffer_size(switch_rtp_t *r
}
if (!max_frames || frames >= max_frames) {
max_frames = frames + 8;
max_frames = frames * 10;
}
rtp_session->last_max_vb_frames = max_frames;
......@@ -4202,7 +4205,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *
}
if (max_queue_frames < queue_frames) {
max_queue_frames = queue_frames * 6;
max_queue_frames = queue_frames * 3;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论