Skype web sdk audio service plugin not found - ionic-framework

I am integrating Skype Web SDK audio service in my IONIC application. Everything works fine but I am not able to make a call. When I click on button to make a call following code gets call and I am getting Beep sound and then error about Pluginnotinstalled.
var conversation = application.conversationsManager.getConversation('tel:+XXXX');
conversation.selfParticipant.audio.state.when('Connected', function () {
console.log('Connected to audio call');
});
conversation.state.changed(function (newValue, reason, oldValue) {
console.log('Conversation state changed from', oldValue, 'to', newValue);
});
conversation.participants.added(function (participant) {
console.log('Participant:', participant.displayName(), 'has been added to the conversation');
});
conversation.audioService.start().then(function() {
console.log('The call has been started successfully');
}, function (error) {
console.log('An error occured starting the call', error);
});
When I run this code, I am getting error, Plugin not Installed. There's no description about what plugin they want.
An error occured starting the call
Error: PluginNotInstalled
Exception — skype-web-sdk.js:20782
(anonymous function) — skype-web-sdk.js:35814
exec2 — skype-web-sdk.js:21498
exec — skype-web-sdk.js:21478
dequeue — skype-web-sdk.js:21253
process — skype-web-sdk.js:21274
When I checked in details, The error is coming from below code of skype-web-sdk.js
function init(specs) {
tm && tm.record(Web.TelemetryEvent.PluginManager, {
action: 'init',
state: state()
});
if (state() == Media.PluginManager.State.Uninitialized) {
var id = '__mainPluginManager_' + guid().replace(/-/g, '_');
Media.log('PluginManager::init - id = ' + id);
language = (specs && specs.language) || "en-us";
isRtl = (specs && specs.rtl) || false;
var PluginObjectCtor_1 = (specs && specs.PluginObject) || Media.PluginObject;
tm = specs && specs.tm;
assert(!task || task.state() != 'pending');
task = new Task('Loading the media plugin.', {
cancel: function (reason) {
Media.log('PluginManager::init canceled ' + id);
stopLoadTimer();
reset(reason);
task.reject(reason);
}
});
tm && tm.monitor(task.promise, Web.TelemetryEvent.PluginManager, {
action: 'initPluginMgr',
state: state(),
id: id
});
state.set(Media.PluginManager.State.Initializing);
isPluginInstalled.get().then(function (installed) {
if (!installed)
throw Exception('PluginNotInstalled');
pluginObj = PluginObjectCtor_1({
id: id,
managerId: '_'
});
pluginObj.event(onPluginObjectEvent, 'async');
pluginObj.state.changed(onPluginObjectState);
Media.watch('pluginObject(' + id + ')::state', state);
Media.log('PluginManager::init - creating inner object');
try {
pluginObj.createInnerObject({
hide: true,
hookEvents: true
});
}
catch (err) {
state.set(Media.PluginManager.State.Uninitialized);
if (task.state() == 'pending')
task.reject(err);
}
}).catch(function (err) {
state.set(Media.PluginManager.State.Uninitialized);
if (task.state() == 'pending')
task.reject(err);
});
}
else {
// init has already been called and the plugin is either
// initializing or is already initialized; in either case
// we will return an existing promise
assert(task);
}
return task.promise;
}

Which browser are you using?
IE11 and Safari both need the Skype for Business Web App plugin which can ben found here: Getting started with Skype Web SDK development
Here you can find more information on how to check if the plugin is installed.

Related

unininstall PWA Manually

The following code can be used to install the program in the PWA:
var fab = document.querySelector('#fab');
var deferredPrompt;
fab.addEventListener('click', function () {
if (deferredPrompt) {
deferredPrompt.prompt();
deferredPrompt.userChoice.then(function (choice) {
if (choice.outcome === 'dismissed') {
console.log('installation was cancelled');
} else {
console.log('User Added To Home Screen');
}
});
deferredPrompt = null;
}
});
//********************************************************************
window.addEventListener('beforeinstallprompt', function (event) {
console.log('beforeinstallprompt run .');
event.preventDefault();
deferredPrompt = event;
return false;
});
now for Uninstall:
It can only be removed from the browser
Now my question is here:
Is it possible to create a code such as manual installation (mentioned above) that the user can uninstall the program without the need to use the browser tool?
Thank you all for your answers

PWA Saving a photo taken without download prompt

I am trying to build a progressive web app that utilizes the device camera to take pictures but want it to save to their Photos gallery without being prompted to download like the native camera app does..Is this even possible..I haven't discovered a way yet and not much info on google about it would it be different if it was uploaded to the cloud?
Thanks
The link at https://whatwebcando.today/photos.html suggests that this may be possible.
capturer = ImageCapture(streamVideoTrack)
Creates an image capturer out of the Media Stream Video Track.
capturer.takePhoto()
Returns a Promise resolved with the photo taken with the current settings.
capturer.setOptions(photoSettings)
Configures the photoSettings for subsequent captures; if visible, the effects of the configuration can be seen in the Track used as input.
This is the example code:
function getUserMedia(options, successCallback, failureCallback) {
var api = navigator.getUserMedia || navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia || navigator.msGetUserMedia;
if (api) {
return api.bind(navigator)(options, successCallback, failureCallback);
}
}
var theStream;
function getStream() {
if (!navigator.getUserMedia && !navigator.webkitGetUserMedia &&
!navigator.mozGetUserMedia && !navigator.msGetUserMedia) {
alert('User Media API not supported.');
return;
}
var constraints = {
video: true
};
getUserMedia(constraints, function (stream) {
var mediaControl = document.querySelector('video');
if ('srcObject' in mediaControl) {
mediaControl.srcObject = stream;
mediaControl.src = (window.URL || window.webkitURL).createObjectURL(stream);
} else if (navigator.mozGetUserMedia) {
mediaControl.mozSrcObject = stream;
}
theStream = stream;
}, function (err) {
alert('Error: ' + err);
});
}
function takePhoto() {
if (!('ImageCapture' in window)) {
alert('ImageCapture is not available');
return;
}
if (!theStream) {
alert('Grab the video stream first!');
return;
}
var theImageCapturer = new ImageCapture(theStream.getVideoTracks()[0]);
theImageCapturer.takePhoto()
.then(blob => {
var theImageTag = document.getElementById("imageTag");
theImageTag.src = URL.createObjectURL(blob);
})
.catch(err => alert('Error: ' + err));
}
So it seems like you can take a photo... I can't see anywhere to indicate that you can then persist this photo in the users storage though. I'd love to be wrong.

Integrating Branch.io in Ionic App

I am trying to send my app's link form my website with a token in the link like this :
branch.link({
stage: 'new user',
data: {
token: 543322
}},
function(err, link) {
console.log(err, link);
});
then when the app is installed by user after clicking on the link, i want to get this token to register the user.
I tried by reading Branch.io docs and implementing it but it's not working.
Can somebody tell me an Example to how to make it work?
Code in my app controller is like this
(():void => {
'use strict';
angular
.module('xyz')
.controller('abc', abc);
function abc (
$window
) {
let vm = this;
$window.Branch.setDebug(true);
$window.Branch.initSession().then(function (res) {
console.log(res);
alert('Response: ' + JSON.stringify(res));
}).catch(function (err) {
console.error(err);
alert('Error: ' + JSON.stringify(err));
});
$window.Branch.getFirstReferringParams().then(function (res) {
// Success Callback
alert('res'+res);
}).catch(function (err) {
// Error Callback
alert('err'+err);
});
$window.Branch.getLatestReferringParams().then(function (res) {
// Success Callback
alert(res);
}).catch(function (err) {
// Error Callback
alert(err);
});
function DeepLinkHandler (data) {
alert('Data from initSession: ' + data.data);
}
$window.DeepLinkHandler = DeepLinkHandler;
})();
Alex from Branch here: there are three steps to this process:
1. Create the link
You're doing this already with the code you provided in your question.
2. Integrate the Branch SDK into your app
The docs page covering the steps for this is here: https://dev.branch.io/getting-started/sdk-integration-guide/guide/cordova/
3. Watch for the incoming link, and route it
The docs page covering what you need for this is here: https://dev.branch.io/getting-started/deep-link-routing/advanced/cordova/
Basically, it is a function that will look something like this:
function DeepLinkHandler(data) {
console.log("received data: " + JSON.stringify(data));
for (key in data) {
if ((key != "type" && key != "source" && key != "bubbles" && key != "cancelBubble") && data[key] != null) {
console.log(key + ": " + data["key"]);
}
}
if (data["token"]) {
// load the view to register the user based on your token
} else {
// load your normal view
}
}

Video.js player add chromecast button?

I have tried numerous ways of adding a cast button to video.js player but cannot do this for the life of me. Can anyone help?
I'm using the hellovideo cms for videos and need plugins added but have no idea about jquery etc.. so please if anyone can help?
There is a really nice plugin for this: https://github.com/kim-company/videojs-chromecast
Just follow the setup instructions (adding the js and css to your page).
I tried kim-company/videojs-chromecast. It only works with an older version of videojs, I used 5.4.6. It's quite buggy. Another I tried was benjipott/video.js-chromecast, which claims to work with newer videojs, but I didn't like it at all. So I gave up on videojs, I always found the native HTML5 video player more reliable and easier to work with (videojs just wraps this anyway). For the chromecast stuff, I provide a nearby button that links to chromecast.link, where I wrote a full web chromecast sender app. Pass the video and poster URL in the fragment, per this example:
https://chromecast.link/#content=http://host/some.mp4,poster=http://host/poster.jpg,subtitles=http://host/webvtt.srt
I recently answered this question, you can check it out here: How to implement chromecast support for html5 player for more information
var session = null;
$( document ).ready(function(){
var loadCastInterval = setInterval(function(){
if (chrome.cast.isAvailable) {
console.log('Cast has loaded.');
clearInterval(loadCastInterval);
initializeCastApi();
} else {
console.log('Unavailable');
}
}, 1000);
});
function initializeCastApi() {
var applicationID = chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID;
var sessionRequest = new chrome.cast.SessionRequest(applicationID);
var apiConfig = new chrome.cast.ApiConfig(sessionRequest,
sessionListener,
receiverListener);
chrome.cast.initialize(apiConfig, onInitSuccess, onInitError);
};
function sessionListener(e) {
session = e;
console.log('New session');
if (session.media.length != 0) {
console.log('Found ' + session.media.length + ' sessions.');
}
}
function receiverListener(e) {
if( e === 'available' ) {
console.log("Chromecast was found on the network.");
}
else {
console.log("There are no Chromecasts available.");
}
}
function onInitSuccess() {
console.log("Initialization succeeded");
}
function onInitError() {
console.log("Initialization failed");
}
$('#castme').click(function(){
launchApp();
});
function launchApp() {
console.log("Launching the Chromecast App...");
chrome.cast.requestSession(onRequestSessionSuccess, onLaunchError);
}
function onRequestSessionSuccess(e) {
console.log("Successfully created session: " + e.sessionId);
session = e;
}
function onLaunchError() {
console.log("Error connecting to the Chromecast.");
}
function onRequestSessionSuccess(e) {
console.log("Successfully created session: " + e.sessionId);
session = e;
loadMedia();
}
function loadMedia() {
if (!session) {
console.log("No session.");
return;
}
var videoSrc = document.getElementById("myVideo").src;
var mediaInfo = new chrome.cast.media.MediaInfo(videoSrc);
mediaInfo.contentType = 'video/mp4';
var request = new chrome.cast.media.LoadRequest(mediaInfo);
request.autoplay = true;
session.loadMedia(request, onLoadSuccess, onLoadError);
}
function onLoadSuccess() {
console.log('Successfully loaded video.');
}
function onLoadError() {
console.log('Failed to load video.');
}
$('#stop').click(function(){
stopApp();
});
function stopApp() {
session.stop(onStopAppSuccess, onStopAppError);
}
function onStopAppSuccess() {
console.log('Successfully stopped app.');
}
function onStopAppError() {
console.log('Error stopping app.');
}

phonegap 3.3 iOS BarcodeScanner module not found

I am developing ios native application using Phonegap. This application has barcode scanning feature. It was working fine with phonegap version 2.9.0. Now, it is not working after I upgrade phonegap version 3.3.0.
It says "module cordova/plugin/BarcodeScanner not found" if I use the following code
var scanner = cordova.require('cordova/plugin/BarcodeScanner');
scanner.scan(function1, function2);
It says undefined If I use the following code
window.plugins.barCodeScanner.scan(func1, func2);
It says undefined If I use the following code
cordova.plugins.barcodeScanner.scan(func1, func2);
I used this link for this implementation. Please let me what am I doing wrong?
I have included barcodescanner.js and it is loaded when the app is loaded. I am sure about.
Also I am not getting any errors while building.
--Sridhar
It is fixed. There is was run-time issue in barcodescanner.js. I found and fixed. It is working fine. The changed code.
cordova.define("cordova/plugin/BarcodeScanner", function (require, exports, module) {
var exec = require("cordova/exec");
function BarcodeScanner() {
this.Encode = {
TEXT_TYPE: "TEXT_TYPE",
EMAIL_TYPE: "EMAIL_TYPE",
PHONE_TYPE: "PHONE_TYPE",
SMS_TYPE: "SMS_TYPE"
// CONTACT_TYPE: "CONTACT_TYPE", // TODO: not implemented, requires passing a Bundle class from Javascript to Java
// LOCATION_TYPE: "LOCATION_TYPE" // TODO: not implemented, requires passing a Bundle class from Javascript to Java
};
};
BarcodeScanner.prototype.scan = function (successCallback, errorCallback) {
if (errorCallback == null) {
errorCallback = function () {
};
}
if (typeof errorCallback != "function") {
console.log("BarcodeScanner.scan failure: failure parameter not a function");
return;
}
if (typeof successCallback != "function") {
console.log("BarcodeScanner.scan failure: success callback parameter must be a function");
return;
}
exec(successCallback, errorCallback, 'BarcodeScanner', 'scan', []);
};
BarcodeScanner.prototype.encode = function (type, data, successCallback, errorCallback, options) {
if (errorCallback == null) {
errorCallback = function () {
};
}
if (typeof errorCallback != "function") {
console.log("BarcodeScanner.encode failure: failure parameter not a function");
return;
}
if (typeof successCallback != "function") {
console.log("BarcodeScanner.encode failure: success callback parameter must be a function");
return;
}
exec(successCallback, errorCallback, 'BarcodeScanner', 'encode', [
{"type": type, "data": data, "options": options}
]);
};
var = new BarcodeScanner();
module.exports = barcodeScanner;
});