Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement PREFFIX_INVALID_MEDIA_ID pluxin.xml preference to disable UUID preffix for bad media ids via config #647 #648

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
</feature>
</config-file>

<preference name="PREFFIX_INVALID_MEDIA_ID" default="TRUE"/>

<config-file target="*-Info.plist" parent="PreffixInvalidMediaId">
<string>$PREFFIX_INVALID_MEDIA_ID</string>
</config-file>

<preference name="MANUAL_INIT_AUDIO_DEVICE" default="FALSE"/>

<config-file target="*-Info.plist" parent="ManualInitAudioDevice">
Expand Down
12 changes: 9 additions & 3 deletions src/PluginMediaStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@ class PluginMediaStream : NSObject {
self.rtcMediaStream = rtcMediaStream;

if (streamId == nil) {
// Handle possible duplicate remote trackId with janus or short duplicate name
// See: https://github.com/cordova-rtc/cordova-plugin-iosrtc/issues/432
if (rtcMediaStream.streamId.count < 36) {

// Handle possible duplicate remote trackId with janus or short duplicate name
// See following issues:
// - https://github.com/cordova-rtc/cordova-plugin-iosrtc/issues/432
// - https://github.com/cordova-rtc/cordova-plugin-iosrtc/issues/647

let shouldPreffixInvalidMediaId = Bundle.main.object(forInfoDictionaryKey: "PreffixInvalidMediaId") as? String

if (shouldPreffixInvalidMediaId == "TRUE" && rtcMediaStream.streamId.count < 36) {
self.id = rtcMediaStream.streamId + "_" + UUID().uuidString;
} else {
self.id = rtcMediaStream.streamId;
Expand Down
12 changes: 9 additions & 3 deletions src/PluginMediaStreamTrack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ class PluginMediaStreamTrack : NSObject {
self.rtcMediaStreamTrack = rtcMediaStreamTrack

if (trackId == nil) {
// Handle possible duplicate remote trackId with janus or short duplicate name
// See: https://github.com/cordova-rtc/cordova-plugin-iosrtc/issues/432
if (rtcMediaStreamTrack.trackId.count<36) {

// Handle possible duplicate remote trackId with janus or short duplicate name
// See following issues:
// - https://github.com/cordova-rtc/cordova-plugin-iosrtc/issues/432
// - https://github.com/cordova-rtc/cordova-plugin-iosrtc/issues/647

let shouldPreffixInvalidMediaId = Bundle.main.object(forInfoDictionaryKey: "PreffixInvalidMediaId") as? String

if (shouldPreffixInvalidMediaId == "TRUE" && rtcMediaStreamTrack.trackId.count < 36) {
self.id = rtcMediaStreamTrack.trackId + "_" + UUID().uuidString;
} else {
self.id = rtcMediaStreamTrack.trackId;
Expand Down