Twilio ERROR: pluginMediaStream with id= already exist
ac1dev opened this issue · 7 comments
YOU MUST read first!
Please use Community Forum for general technical discussions and questions.
- I have used Google with the error message or bug in association with the library and Cordova words to make sure the issue I'm reporting is only related to iOSRTC.
- I have provided steps to reproduce (e.g. using sample app code https://github.com/cordova-rtc/cordova-plugin-iosrtc-sample or updated
extra/renderer-and-libwebrtc-tests.js
file). - I have provided versions of third party library name, ios, Xcode and plugin version and adapter.js version if used.
Note: If the checkboxes above are not checked (which you do after the issue is posted), the issue will be closed, removing this checkbox will result in automatic closed issue.
Versions affected
- Capacitor version (e.g 7.1.0): 2.4.6
- Plugin version (e.g 6.0.12): 6.0.12 & 6.0.21 (tried both)
- Ionic/React version: 5.5.0
- iOS version (e.g 10.2): 14.5.1
- Xcode version (e.g 11.1 - 11A1027): 12.5 - 12E262
- WebRTC-adapter version (e.g. 7.4.0): /
- WebRTC Framework version (e.g. JSSip 3.1.2): Twilio Video 2.13.1
Description
I have issue with plugin throwing error:
ERROR: pluginMediaStream with id=298A7E66-EDC5-4CC7-B367-8656213E3C0C already exist
I tried multiple things to fix this, all from GitHub issues that were previously open on this project, but nothing worked, unfortunately.
I found similar problem on another older issue, and I downloaded 6.0.12 specific commit that was shown there, and I also modified PluginMediaStream.swift line 25, changed it to this: self.id = rtcMediaStream.streamId + "_" + UUID().uuidString + String(rtcMediaStream.streamId.count);
but it still won't work.
Steps to reproduce
Setup twilio video
Install cordova-plugin-iosrtc
Try the following:
Example code:
const registerRTC = () => {
if (window.cordova.plugins.iosrtc) {
window.cordova.plugins.iosrtc.registerGlobals();
MediaStreamTrack.prototype.clone = function () {
return this;
};
window.cordova.plugins.iosrtc.debug.enable('*', true);
}
};
useEffect(() => {
registerRTC();
MediaStreamTrack.prototype.clone = function () {
return this;
};
Video.connect(token, {
name: chatDocument.id,
audio: true,
maxAudioBitrate: 16000,
video: { height: 720, frameRate: 24, width: 1280 },
})
.then((room) => {
setRoom(room);
room.on('participantConnected', participantConnected);
room.on('participantDisconnected', participantDisconnected);
room.participants.forEach(participantConnected);
})
.catch((err) => {
console.log(err, { message: err.message });
});
return () => {
setRoom((currentRoom) => {
if (currentRoom && currentRoom.localParticipant.state === 'connected') {
currentRoom.localParticipant.tracks.forEach(function (trackPublication) {
trackPublication.track.stop();
});
currentRoom.disconnect();
return null;
} else {
return currentRoom;
}
});
};
}, []);
Expected results
To work
Actual results
Doesn't work, throws error
Use Twilio 2.4.0+
Also you need to setup sdpSemantics and bundlePolicy like below if you use 6+ if you use master it's not needed
Video.connect(config.token, {
name: config.room,
tracks: tracks,
sdpSemantics: 'plan-b',
bundlePolicy: 'max-compat'
})
https://github.com/cordova-rtc/cordova-plugin-iosrtc-sample/blob/master/www/js/index-twilio.js#L74
Also #648
In any case "ERROR: pluginMediaStream with id= already exist" is not the error that prevent you to have it working, this error is not fatal.
Use Twilio 2.4.0+
I use newer version, 2.4.0 is from 2018
Also you need to setup sdpSemantics and bundlePolicy like below if you use 6+ if you use master it's not needed
Will try with this now
In any case "ERROR: pluginMediaStream with id= already exist" is not the error that prevent you to have it working, this error is not fatal.
I think it also produces this error:
TypeError: track must be a LocalAudioTrack, LocalVideoTrack, LocalDataTrack, or MediaStreamTrack
And I can't see local participant video or peer video / audio, it does not initialize.
Thanks!
I use newer version, 2.4.0 is from 2018
Your report say "Twilio Video 2.13.1"
It Worked for other, you need to try again see here
#675 (comment)
You may also try master see #687 (comment)
I cannot help you fix something that other have fixed by applying the right fixed the same week.