Safari WebRTC support in IOS 11 - ios

We have an application developed using WebRTC in iOS 11, and it says it supports WebRTC but the application is not working in Safari on iOS 11. Is there anything required to do from our end to support this on the Safari browser? Do we have to make any changes in the script? Please help.

Did you got the last adapter.js that assume the browser compatibility ?
Regards

Here is a sample code that worked for me
// create video element first
var video = document.createElement('video');
video.style.width = document.width + 'px';
video.style.height = document.height + 'px';
video.setAttribute('autoplay', '');
video.setAttribute('muted', '');
video.setAttribute('playsinline', '');
document.body.appendChild(video);
//setup your constraints
constraints = {
audio: false,
video: {
facingMode: front
}
}
//ask navigator to allow access
navigator.mediaDevices.getUserMedia(constraints).then(function
success(stream) {
video.srcObject = stream;
});
});

Related

Ionic 2 streaming media plugin not working on iOS

I created a live streaming app, i used the streaming media plugin for playing the videos and it works well on android but it doesn't work on iOS.
The video player open successfully but the video not working and no errors appear in the console.
Link of the plugin
playVideo(url) {
let options: StreamingVideoOptions = {
successCallback: () => { console.log('Finished Video') },
errorCallback: (e) => { console.log('Error: ', e) },
orientation: 'portrait'
};
this.streamingMedia.playVideo(url, options);
}
Use IONIC InAppBrowser instead of StreamingVideoOptions
InAppBrowser Docs
-https://ionicframework.com/docs/native/in-app-browser/
Use this code for ios
const browser = this.iab.create(url, '_self');
browser.show;
Use this code for android
streamingMedia.playVideo(url, options);

Web Audio API not playing sound sample on device, but works in browser

I have an Ionic app that is a metronome. Using Web Audio API I have made everything work using the oscillator feature, but when switching to use a wav file no audio is playing on a real device (iPhone).
When testing in the browser using Ionic Serve (chrome) the audio plays fine.
Here is what I have:
function snare(e) {
var audioSource = 'assets/audio/snare1.wav';
var request = new XMLHttpRequest();
request.open('GET', audioSource, true);
request.responseType = 'arraybuffer';
// Decode asynchronously
request.onload = function() {
audioContext.decodeAudioData(request.response, function(theBuffer) {
buffer = theBuffer;
playSound(buffer);
});
}
request.send();
}
function playSound(buffer) {
var source = audioContext.createBufferSource();
source.buffer = buffer;
source.connect(audioContext.destination);
source.start(0);
}
The audio sample is in www/assets/audio.
Any ideas where this could be going wrong?
I believe iOS devices require a user-gesture of some sort to allow playing of audio.
It's July 2017, iOS 10.3.2 and we're still finding this issue on Safari on iPhones. Interestingly Safari on a MacBook is fine.
#Raymond Toy's general observation still appears to be true. But #padenot's approach (via https://gist.github.com/laziel/7aefabe99ee57b16081c) did not work for me in a situation where I wanted to play a sound in response to some external event/trigger.
Using the original poster's code, I've had some success with this
var buffer; // added to make it work with OP's code
// keep the original function snare()
function playSound() { // dropped the argument for simplicity.
var source = audioContext.createBufferSource();
source.buffer = buffer;
source.connect(audioContext.destination);
source.start(0);
}
function triggerSound() {
function playSoundIos(event) {
document.removeEventListener('touchstart', playSoundIos);
playSound();
}
if (/iPad|iPhone/.test(navigator.userAgent)) {
document.addEventListener('touchstart', playSoundIos);
}
else { // Android etc. or Safari, but not on iPhone
playSound();
}
}
Now calling triggerSound() will produce the sound immediately on Android and will produce the sound on iOS after the browser page has been touched.
Still not ideal, but better than no sound at all...
I had a similar issue in current iOS (15). I tried to play base64 encoded binary data which worked in all browsers, but not on iOS.
Finally reordering of the statements solved my issue:
let buffer = Uint8Array.from(atob(base64), c => c.charCodeAt(0));
let context = new AudioContext();
// these lines were within "play()" before
audioSource = context.createBufferSource();
audioSource.connect(context.destination);
audioSource.start(0);
// ---
context.decodeAudioData(buffer.buffer, play, (e) => {
console.warn("error decoding audio", e)
});
function play(audioBuffer) {
audioSource.buffer = audioBuffer;
}
Also see this commit in my project.
I assume that calling audioSource.start(0) within the play() method was somehow too late because it's within a callback after context.decodeAudioData() and therefore maybe "too far away" from a user interaction for the standards of iOS.

Air for IOS Webview - apple app review says every tab and/or button launches mobile Safari.?

I pulling my hair out trying to figure out where I have gone wrong.
I created a very simple app for ios that uses webView to load certain webpages within app. from my knowledge and every ios air webView reference I have found online I have coded everything correctly. Runs beautifully on android.
apple app review says every tab and/or button launches mobile Safari.?
I don't see how this is possible because they even said my button that only has gotoAndPlay(2); apparently that navigates to Safari also. ?
here's the code I used for webView:
QMBTN.addEventListener(MouseEvent.CLICK, QMB);
function QMB(event:MouseEvent):void
{
webView.viewPort = new Rectangle( 0, 135, stage.stageWidth, 600 );
webView.stage = this.stage;
webView.loadURL( "http://mywebpageeurl.com.au" );
whiteBOX.gotoAndStop(2);
}
and this is the code for my internal frame nav.
Menu_BTN2.addEventListener(MouseEvent.CLICK, GoMenuSRC);
function GoMenuSRC(event:MouseEvent):void
{
webView.stage = null;
whiteBOX.gotoAndStop(1);
}
Am I missing something or ????
The only other thing I could think could be the culprit might be my error handler to handle errors when I click tel: or mailto: links on my webpages.
The code for the tel: / mailto: error handling.
// Error handle
var openLinksInDefaultBrowser = false;
//Check tel: func
function cdCTfunc():void
{
var NEWtelLNK = webView.location.substr(0,4);
if (NEWtelLNK=='tel:')
{
openLinksInDefaultBrowser = true;
}else{openLinksInDefaultBrowser = false;}
}
webView.addEventListener(LocationChangeEvent.LOCATION_CHANGING, function (ev:LocationChangeEvent):void
{
cdCTfunc();
if(openLinksInDefaultBrowser == false)
{
ev.preventDefault();
webView.loadURL(ev.location); //'ev.url' changed to 'ev.location'started with prerelease build - [07/20/10]
}
if (openLinksInDefaultBrowser == true)
{
trace('page loaded in default browser');
var phStr:String=ev.location;
var callPH:URLRequest= new URLRequest(phStr);
navigateToURL(callPH);
}
});
webView.addEventListener(LocationChangeEvent.LOCATION_CHANGE, function (ev:LocationChangeEvent):void
{
if (webView.location.indexOf('authentication_complete') != -1)
{
trace('auth token is: ' + webView.location.substr(webView.location.indexOf('token=') + 6));
}
trace('the new location is: ' + webView.location);
trace(webView.location.substr(0,4));
});
webView.addEventListener('complete', function(ev:Event):void
{
trace('complete event');
});
webView.addEventListener('error', function(ev:ErrorEvent):void
{
var phStr:String=webView.location;
var callPH:URLRequest= new URLRequest(phStr);
navigateToURL(callPH);
webView.isHistoryBackEnabled;
webView.historyBack();
trace('SOME Bloody Error Loading The Page: ' + ev.text);
trace(openLinksInDefaultBrowser);
});
but I still don't see how this could cause a gotoAndStop(); to launch safari.
I am absolutely stumped.
Please Help?
Thank you in advance.
Before submitting your app for review you should run it through Testflight.
This allows you to test an 'AppStore' build of your binary so you will see exactly what the reviewer will see.
http://www.yeahbutisitflash.com/?p=7608

iOS 9 can’t play audio/video files that are downloaded to device

Has anyone else had this issue?
When I use the cordova media plugin in order to play an mp3 file on iOS, I get no error or response as to why it's not working.
I've gotten the ngCordova media plugin to work in my app on my ios emulator, using an external URL to play the audio file...however, I'm trying to build some functionality where basically you download the mp3 from an external source, save it to your device, and then play the file from there. I can't seem to get it work, even though I can verify that the file does exist. Here is my code for the function:
$scope.playAudio = function() {
document.addEventListener('deviceready', function () {
var src = cordova.file.dataDirectory + fileSrc;
var media = $cordovaMedia.newMedia(src);
var iOSPlayOptions = {
numberOfLoops: 1,
playAudioWhenScreenIsLocked : true
};
media.play(iOSPlayOptions); // iOS only!
media.play(); // Android
});
}
I should note that this functionality DOES work on my android device, but on both my ios simulator AND real device, it does absolutely nothing.
I should note that I'm using iOS 9 and xCode 7.1
Has anyone else had any issues with trying to play an audio or video file from their local device, in their app?
So it looks like I was able to solve the problem by resolving the local filepath to an internal URL using the $window.resolveLocalFileSystemURL() and src.toInternalURL() functions
$scope.playAudio = function() {
document.addEventListener('deviceready', function () {
var src = cordova.file.dataDirectory + fileSrc;
$window.resolveLocalFileSystemURL(src, function(dir){
basePath = dir.toInternalURL();
media = $cordovaMedia.newMedia(basePath);
var iOSPlayOptions = {
numberOfLoops: 1,
playAudioWhenScreenIsLocked : true
};
$scope.data.playing = true;
media.play(iOSPlayOptions); // iOS only!
//media.play(); // Android
})
});
}

Jplayer is not working with mobile Browser (IPAD)

HI All,
I am working with Jplayer on IPAD, and I have implemented the Jplayer plugin and it is working with all browser with But with IPAD it is showing below error message.
"Error Hint:- Check media URl is valid
Context:- Media URl could not be loaded"
Could anyone help me code snippet is given below. (I have tested with 2.4 also the same error is persisting there as well).
Below is the function inisiatating Jpalyer
startAudio: function() {
var _this = this;
_this.initJPlayerHandlers();
var solution_type = "flash, html";
if($.browser.msie && parseInt($.browser.version, 10) > 8) {
solution_type = "html, flash";
}
_this.jplayer_el.jPlayer({
ready: function() {
$(this).jPlayer(
"setMedia", {
mp3: "/wd/mca.mp3?BID=" + MCA.singletons.self.bid
}).jPlayer("play");
},
supplied: "mp3",
swfPath: "js",
solution: solution_type,
preload: "none"
});
},
I am using IPAD4 having IOS 7 and IPad mini with IOS7.This issue is coming up only with IPAD4.
Autoplay is not supported on iOS and Andriod
JQuery jPlayer autoplay not working on ipad how to show controls
http://www.jplayer.org/latest/quick-start-guide/example-audio-soundtrack/

Resources