tokbox : Subscriber time out error on Safari - webrtc

Using opentok.js v2,  the video channel works fine with Chrome and Firefox . The opentok version used is from this link: https://static.opentok.com/v2/js/opentok.min.js
But it doesn't work with safari 11.0.3.
On session's stream created event, it generates following error message "The stream was unable to connect due to a network error. Make sure your connection isnt blocked by a firewall"
The publisher is published successfully i.e session.publish(..) works fine.
The code below is used to make a video call:
this.session=OT.initSession(this.apiKey, this.sessionId);
this.session.on({
streamCreated: (event) => {
 
this.session.subscribe(event.stream, 'subscriber');
},
streamDestroyed: (event) => {
console.log(`Stream ${event.stream.name} ended because ${event.reason}`);
}
});
this.session.connect(this.token, () => {
this.publisher=OT.initPublisher('publisher');
this.session.publish(this.publisher);
});
}
 
Other exceptions in console generated by opentok.js are as follows: 
[Error] OT.exception :: title: undefined (1554) msg: OT.Subscriber PeerConnection Error: OT.Subscriber failed to subscribe to a stream in a reasonable amount of time
error
_exceptionHandler (vendor.js:150924)
handleJsException (vendor.js:151002)
onPeerConnectionFailure (vendor.js:162673)
(anonymous function) (vendor.js:162414)
onInvokeTask (vendor.js:4239)
runTask (polyfills.js:3:10225)
invokeTask (polyfills.js:3:16182)
n (polyfills.js:2:31400)
[Error] OT_ICE_WORKFLOW_FAILED: ICEWorkflow: Subscriber PeerConnection with connection (not found) failed: OT.Subscriber failed to subscribe to a stream in a reasonable amount of time
error
dispatchOTError (vendor.js:159161)
(anonymous function) (vendor.js:160080)
handleThisOnce (vendor.js:137437)
(anonymous function) (vendor.js:137675)
onInvokeTask (vendor.js:4239)
runTask (polyfills.js:3:10225)
invokeTask (polyfills.js:3:16182)
n (polyfills.js:2:31400)
[Error] OT.exception :: title: undefined (1554) msg: ICEWorkflow: Subscriber PeerConnection with connection (not found) failed: OT.Subscriber failed to subscribe to a stream in a reasonable amount of time
error
_exceptionHandler (vendor.js:150924)
handleJsException (vendor.js:151002)
dispatchOTError (vendor.js:159163)
(anonymous function) (vendor.js:160080)
handleThisOnce (vendor.js:137437)
(anonymous function) (vendor.js:137675)
onInvokeTask (vendor.js:4239)
runTask (polyfills.js:3:10225)
invokeTask (polyfills.js:3:16182)
n (polyfills.js:2:31400)
 
 
All the above errors  are generated only on Safari browser. 

You need to make sure you have created a Safari Project in your OpenTok Account Portal. More details at https://tokbox.com/developer/sdks/js/safari/
It looks like you're using a polyfills.js file. If that is the polyfill from Angular that includes zone.js then you will need to include the fix for RTCPeerConnections 'zone.js/dist/webapis-rtc-peer-connection' in your polyfills.js file.
import 'zone.js/dist/webapis-rtc-peer-connection';
You will also probably want to include the polyfill for getUserMedia. More details at https://github.com/angular/zone.js/issues/948#issuecomment-357558384

Related

WebRTC Error - Session error description: Data channel type mismatch. Expected RTP, got SCTP

I am new to WebRTC and triyng to create my first app. I have found this article https://www.tutorialspoint.com/webrtc/webrtc_quick_guide.htm and did as it was said there. The resulted app works fine if I test it in the Chrome. But when I try to test this app in 2 browser (Chrome and Mozilla) it gives me this error:
Uncaught (in promise) DOMException: Failed to execute
'setRemoteDescription' on 'RTCPeerConnection': Session error code:
ERROR_CONTENT. Session error description: Data channel type mismatch.
Expected RTP, got SCTP..
This happens when I send an offer from Mozilla client and Chrome client tries to give an answer to this offer in this part of code:
myConnection.setRemoteDescription(new RTCSessionDescription(offer));
myConnection.createAnswer(function (answer) {
myConnection.setLocalDescription(answer);
send({
type: "answer",
answer: answer
});
}, function (error) {
alert("oops...error"); //<-- this alert fires all the time
});
I have googled this and all I have found is set new RTCPeerConnection(configuration, { optional: [{RtpDataChannels: false}] }) but if I do so then when I try to send a message it says that dataChannel.readyState is not openned.
What do I do wrong? Any help appriciated!
Thanks!
Remove optional: [{RtpDataChannels: true}] and then wait for the datachannel.onopen event to fire before attempting to send messages.

Firebase Messaging fails sporadically with internal-error

I've been getting internal error quite a lot this week while sending messages to my iOS devices through the Node.js library (code is the same, same library version etc.)
It's hard to debug because sometimes it works. When I put a for loop to send 10 messages, my devices would get 3-4.
FirebaseMessagingError: Internal error encountered.
> at FirebaseMessagingError.FirebaseError [as constructor] (/node_modules/firebase-admin/lib/utils/error.js:42:28)
> at FirebaseMessagingError.PrefixedFirebaseError [as constructor] (/node_modules/firebase-admin/lib/utils/error.js:88:28)
> at new FirebaseMessagingError (/node_modules/firebase-admin/lib/utils/error.js:254:16)
> at Function.FirebaseMessagingError.fromServerError (/node_modules/firebase-admin/lib/utils/error.js:287:16)
> at Object.createFirebaseError (/node_modules/firebase-admin/lib/messaging/messaging-errors.js:34:47)
> at FirebaseMessagingRequestHandler.buildSendResponse (/node_modules/firebase-admin/lib/messaging/messaging-api-request.js:119:47)
> at /node_modules/firebase-admin/lib/messaging/messaging-api-request.js:94:30
> at Array.map (<anonymous>)
> at /node_modules/firebase-admin/lib/messaging/messaging-api-request.js:93:30
> at processTicksAndRejections (internal/process/task_queues.js:97:5) {
> errorInfo: {
> code: 'messaging/internal-error',
> message: 'Internal error encountered.'
> },
> codePrefix: 'messaging'
> }
I tried changing the auth key, but still getting errors.
Code is very simple
import * as admin from 'firebase-admin'
admin.initializeApp()
async function sendPushNotification(
tokens: string[],
title: string,
body: string
): Promise<admin.messaging.BatchResponse> {
console.log('sending %s to %d devices', body, tokens.length)
const message = {
notification: {
title: title,
body: body,
},
tokens: tokens,
apns: {
payload: {
aps: {
sound: 'default',
},
},
},
}
return admin.messaging().sendMulticast(message)
}
I have been having the same problem: node.js firebase admin SDK sending notifications to iOS occasionally fails with 500/ISE.
It seems specific to, or at least more common with, iOS as during Android development I never had this issue. I contacted Firebase support and here is what they said:
Internal Server Error are usually due to timeouts. Some minor hiccups can't be avoided that's why we recommend developers to implement exponential back-off retry mechanism. You can refer to this StackOverflow discussion for more information on retry-after and exponential back offs.
It seems like a good idea to build in some retry support on my side in any case. I haven't used it before but I like the look of the cockatiel module on npm. I'm planning on going with the retryWithBreaker example given at the start of their README, just with the backoff attempts and breaker set higher, maybe 5 and 20 respectively.

WebSocket connection to 'wss://tracker.btorrent.xyz/' failed: Error during WebSocket handshake: Unexpected response code: 522 {webtorrent}

Hello fellow homo sapiens, I seem to have reached a dead end here and would require your assistance. I am using webtorrent-hybrid to display a torrent, however when I use client.add to download my torrent, I get this error,
ICE failed, add a TURN server and see about:webrtc for more details 10
Firefox can’t establish a connection to the server at wss://tracker.btorrent.xyz/.
and this is the code if you are curious,
client.add(torrentId, function (torrent) {
var file = torrent.files.find(function (file) {
return file.name.endsWith('.mp4')
})
var info = torrent.ready
console.log(info)
file.appendTo('body')
console.log(file)
// Display the file by adding it to the DOM. Supports video, audio, image, etc. files
})
I would thankful if you could assist me in my problem.

Can't fetch data from local api React-Native

I have a web application, in react using an API made in Laravel. I want to make a mobile app using the same API. I can't fetch data, because I get NETWORK REQUEST FAILED error. This is how I try to fetch data:
handleButton = () => {
try {
fetch(`127.0.0.1:8081/test`).then(response =>
console.log(response)
);
} catch (e) {
console.log(e);
}
};
I tried changing the ip in dev settings to my machine id, i tried using localhost not the ip(127.0.0.1) but none of those fixed it... I can't seem to find anything else. Here is the error text:
Possible Unhandled Promise Rejection (id: 0):
TypeError: Network request failed
TypeError: Network request failed
at XMLHttpRequest.xhr.onerror (blob:http://localhost:8081/cfc373de-8318-4df3-b46a-7b17d4926c5e:42556:18)
at XMLHttpRequest.dispatchEvent (blob:http://localhost:8081/cfc373de-8318-4df3-b46a-7b17d4926c5e:47998:27)
at XMLHttpRequest.setReadyState (blob:http://localhost:8081/cfc373de-8318-4df3-b46a-7b17d4926c5e:46859:20)
at XMLHttpRequest.__didCompleteResponse (blob:http://localhost:8081/cfc373de-8318-4df3-b46a-7b17d4926c5e:46686:16)
at blob:http://localhost:8081/cfc373de-8318-4df3-b46a-7b17d4926c5e:46796:47
at RCTDeviceEventEmitter.emit (blob:http://localhost:8081/cfc373de-8318-4df3-b46a-7b17d4926c5e:16875:37)
at MessageQueue.__callFunction (blob:http://localhost:8081/cfc373de-8318-4df3-b46a-7b17d4926c5e:16488:44)
at blob:http://localhost:8081/cfc373de-8318-4df3-b46a-7b17d4926c5e:16245:17
at MessageQueue.__guard (blob:http://localhost:8081/cfc373de-8318-4df3-b46a-7b17d4926c5e:16442:13)
at MessageQueue.callFunctionReturnFlushedQueue (blob:http://localhost:8081/cfc373de-8318-4df3-b46a-7b17d4926c5e:16244:14)
EDIT:
I am using android studio's emulator, because i don't have an android device running android > 5
Use the IP of your machine on the local network.
Open up terminal/cmd.
If you're using a mac, you can use ifconfig and it's usually under en0. You will see something like 192.168.0.32 or similar.
If you're using windows, you can use ipconfig.

changing privacy settings of video using vimeo api

i am trying to change the privacy settings of vimeo video using api class
below is my code
$vimeo = new phpVimeo('myconsumer_key', 'myconsumer_secret');
$info = $vimeo->call('vimeo.videos.setPrivacy', array('video_id' =>$videoid,'privacy'=>'nobody','users'=>$username,'password'=>""));
i provided the consumer key and consumer secret key which i generated from https://developer.vimeo.com/apps/new but when i call the function error occoured
Fatal error: Uncaught exception 'VimeoAPIException' with message 'Permission Denied' in D:\phpweb\Rohith\vimeo_video\vimeo.php:239 Stack trace: #0 D:\phpweb\Rohith\vimeo_video\vimeo.php(275): phpVimeo->_request('vimeo.videos.se...', Array, 'GET', 'http://vimeo.co...', true) #1 D:\phpweb\Rohith\vimeo_video\disablevideo.php(18): phpVimeo->call('vimeo.videos.se...', Array) #2 {main} thrown in D:\phpweb\Rohith\vimeo_video\vimeo.php on line 239