From 36d9f7bc5e4a1644cdcf8c00df976d5283885ea3 Mon Sep 17 00:00:00 2001 From: Chad Phillips Date: Thu, 26 Jul 2018 13:37:32 -0500 Subject: [PATCH] FS-11280: Allow overriding permissionCallback per Verto dialog Currently the 'permissionCallback' object is only available at the Verto instance level. This is problematic in multi-call scenarios, where an individual call dialog needs access to the onGranted/onDenied callback functions. The patch adds a check for existence of onGranted/onDenied callback functions at the dialog level, with a fallback to the original behavior of calling onGranted/onDenied from the Verto instance if it's not available on the dialog. This preserves backwards compatibility while allowing per-dialog overrides going forward. --- html5/verto/js/src/jquery.verto.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/html5/verto/js/src/jquery.verto.js b/html5/verto/js/src/jquery.verto.js index c913ca4140..5db7951d78 100644 --- a/html5/verto/js/src/jquery.verto.js +++ b/html5/verto/js/src/jquery.verto.js @@ -2053,7 +2053,11 @@ }; RTCcallbacks.onStream = function(rtc, stream) { - if (dialog.verto.options.permissionCallback && + if (dialog.callbacks.permissionCallback && + typeof dialog.callbacks.permissionCallback.onGranted === 'function') { + dialog.callbacks.permissionCallback.onGranted(stream); + } + else if (dialog.verto.options.permissionCallback && typeof dialog.verto.options.permissionCallback.onGranted === 'function'){ dialog.verto.options.permissionCallback.onGranted(stream); } @@ -2061,7 +2065,11 @@ }; RTCcallbacks.onError = function(e) { - if (dialog.verto.options.permissionCallback && + if (dialog.callbacks.permissionCallback && + typeof dialog.callbacks.permissionCallback.onDenied === 'function') { + dialog.callbacks.permissionCallback.onDenied(); + } + else if (dialog.verto.options.permissionCallback && typeof dialog.verto.options.permissionCallback.onDenied === 'function'){ dialog.verto.options.permissionCallback.onDenied(); }