Skip to content

Commit

Permalink
Merge pull request #3 from blackuy/master
Browse files Browse the repository at this point in the history
IOS SDK 4.1
  • Loading branch information
enriqueviard authored Mar 8, 2021
2 parents 4cb6b8d + 0030ed6 commit 893961b
Show file tree
Hide file tree
Showing 18 changed files with 219 additions and 243 deletions.
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Example/
.idea
.circleci
2 changes: 1 addition & 1 deletion Example/ios/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-frameworks.sh",
"${PODS_ROOT}/TwilioVideo/Build/iOS/TwilioVideo.framework",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/TwilioVideo/TwilioVideo.framework/TwilioVideo",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
10 changes: 5 additions & 5 deletions Example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ PODS:
- glog (0.3.4)
- React (0.59.9):
- React/Core (= 0.59.9)
- react-native-twilio-video-webrtc (1.0.2-1):
- react-native-twilio-video-webrtc (2.0.0):
- React
- TwilioVideo (~> 3.7)
- TwilioVideo (~> 4.1)
- React/Core (0.59.9):
- yoga (= 0.59.9.React)
- React/CxxBridge (0.59.9):
Expand All @@ -35,7 +35,7 @@ PODS:
- React/cxxreact
- React/jsi
- React/jsinspector (0.59.9)
- TwilioVideo (3.7.1)
- TwilioVideo (4.1.0)
- yoga (0.59.9.React)

DEPENDENCIES:
Expand Down Expand Up @@ -68,8 +68,8 @@ SPEC CHECKSUMS:
Folly: de497beb10f102453a1afa9edbf8cf8a251890de
glog: 1de0bb937dccdc981596d3b5825ebfb765017ded
React: a86b92f00edbe1873a63e4a212c29b7a7ad5224f
react-native-twilio-video-webrtc: c33953a98c71b8600ba321e01f52c62e0c20ab6e
TwilioVideo: 807526f68043a11f0e17e5c26ef0f0f73d5678e4
react-native-twilio-video-webrtc: 5b40ee0129687cb89fb5055680aed35c8db4be07
TwilioVideo: 17bfe3dcac945c6c1235c4584dc37e07a28ccb61
yoga: 03ff42a6f223fb88deeaed60249020d80c3091ee

PODFILE CHECKSUM: a22eec28b45c6a20b9c752a17cdef0f608e13c10
Expand Down
8 changes: 4 additions & 4 deletions Example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2615,9 +2615,9 @@ [email protected]:
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==

ini@~1.3.0:
version "1.3.5"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927"
integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==
version "1.3.8"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c"
integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==

inquirer@^3.0.6:
version "3.3.0"
Expand Down Expand Up @@ -4713,7 +4713,7 @@ react-is@^16.8.1, react-is@^16.8.3, react-is@^16.8.4:
integrity sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA==

"react-native-twilio-video-webrtc@file:..":
version "1.0.2-1"
version "2.0.0"
dependencies:
prop-types "^15.5.10"

Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ dependencies {

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.android.support:appcompat-v7:$androidSupportVersion"
implementation "com.twilio:video-android:5.10.0"
implementation "com.twilio:video-android:5.10.1"
implementation 'org.webrtc:google-webrtc:1.0.30039'
implementation "com.facebook.react:react-native:+" // From node_modules
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,15 @@
import static com.twiliorn.library.CustomTwilioVideoView.Events.ON_PARTICIPANT_REMOVED_VIDEO_TRACK;
import static com.twiliorn.library.CustomTwilioVideoView.Events.ON_STATS_RECEIVED;
import static com.twiliorn.library.CustomTwilioVideoView.Events.ON_VIDEO_CHANGED;
import static com.twiliorn.library.CustomTwilioVideoView.Events.ON_DOMINANT_SPEAKER_CHANGED;

public class CustomTwilioVideoView extends View implements LifecycleEventListener, AudioManager.OnAudioFocusChangeListener {
private static final String TAG = "CustomTwilioVideoView";
private static final String DATA_TRACK_MESSAGE_THREAD_NAME = "DataTrackMessages";
private boolean enableRemoteAudio = false;
private boolean enableNetworkQualityReporting = false;
private boolean isVideoEnabled = false;
private boolean dominantSpeakerEnabled = false;

@Retention(RetentionPolicy.SOURCE)
@StringDef({Events.ON_CAMERA_SWITCHED,
Expand All @@ -129,7 +131,9 @@ public class CustomTwilioVideoView extends View implements LifecycleEventListene
Events.ON_PARTICIPANT_ENABLED_AUDIO_TRACK,
Events.ON_PARTICIPANT_DISABLED_AUDIO_TRACK,
Events.ON_STATS_RECEIVED,
Events.ON_NETWORK_QUALITY_LEVELS_CHANGED})
Events.ON_NETWORK_QUALITY_LEVELS_CHANGED,
Events.ON_DOMINANT_SPEAKER_CHANGED
})
public @interface Events {
String ON_CAMERA_SWITCHED = "onCameraSwitched";
String ON_VIDEO_CHANGED = "onVideoChanged";
Expand All @@ -152,6 +156,7 @@ public class CustomTwilioVideoView extends View implements LifecycleEventListene
String ON_PARTICIPANT_DISABLED_AUDIO_TRACK = "onParticipantDisabledAudioTrack";
String ON_STATS_RECEIVED = "onStatsReceived";
String ON_NETWORK_QUALITY_LEVELS_CHANGED = "onNetworkQualityLevelsChanged";
String ON_DOMINANT_SPEAKER_CHANGED = "onDominantSpeakerDidChange";
}

private final ThemedReactContext themedReactContext;
Expand Down Expand Up @@ -386,11 +391,12 @@ public void releaseResource() {

public void connectToRoomWrapper(
String roomName, String accessToken, boolean enableAudio, boolean enableVideo,
boolean enableRemoteAudio, boolean enableNetworkQualityReporting) {
boolean enableRemoteAudio, boolean enableNetworkQualityReporting, boolean dominantSpeakerEnabled) {
this.roomName = roomName;
this.accessToken = accessToken;
this.enableRemoteAudio = enableAudio;
this.enableNetworkQualityReporting = enableNetworkQualityReporting;
this.dominantSpeakerEnabled = dominantSpeakerEnabled;

// Share your microphone
localAudioTrack = LocalAudioTrack.create(getContext(), enableAudio);
Expand Down Expand Up @@ -430,6 +436,8 @@ public void connectToRoom(boolean enableAudio) {
connectOptionsBuilder.dataTracks(Collections.singletonList(localDataTrack));
}

connectOptionsBuilder.enableDominantSpeaker(this.dominantSpeakerEnabled);

if (enableNetworkQualityReporting) {
connectOptionsBuilder.enableNetworkQuality(true);
connectOptionsBuilder.networkQualityConfiguration(new NetworkQualityConfiguration(
Expand Down Expand Up @@ -831,6 +839,22 @@ public void onRecordingStarted(Room room) {
@Override
public void onRecordingStopped(Room room) {
}

@Override
public void onDominantSpeakerChanged(Room room, RemoteParticipant remoteParticipant) {
WritableMap event = new WritableNativeMap();

event.putString("roomName", room.getName());
event.putString("roomSid", room.getSid());

if (remoteParticipant == null) {
event.putString("participant", "");
} else {
event.putMap("participant", buildParticipant(remoteParticipant));
}

pushEvent(CustomTwilioVideoView.this, ON_DOMINANT_SPEAKER_CHANGED, event);
}
};
}

Expand Down Expand Up @@ -913,8 +937,6 @@ public void onAudioTrackUnpublished(RemoteParticipant participant, RemoteAudioTr

}



@Override
public void onDataTrackSubscribed(RemoteParticipant remoteParticipant, RemoteDataTrackPublication remoteDataTrackPublication, RemoteDataTrack remoteDataTrack) {
WritableMap event = buildParticipantDataEvent(remoteParticipant);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import static com.twiliorn.library.CustomTwilioVideoView.Events.ON_PARTICIPANT_DISABLED_AUDIO_TRACK;
import static com.twiliorn.library.CustomTwilioVideoView.Events.ON_STATS_RECEIVED;
import static com.twiliorn.library.CustomTwilioVideoView.Events.ON_NETWORK_QUALITY_LEVELS_CHANGED;
import static com.twiliorn.library.CustomTwilioVideoView.Events.ON_DOMINANT_SPEAKER_CHANGED;


public class CustomTwilioVideoViewManager extends SimpleViewManager<CustomTwilioVideoView> {
Expand Down Expand Up @@ -79,7 +80,8 @@ public void receiveCommand(CustomTwilioVideoView view, int commandId, @Nullable
boolean enableVideo = args.getBoolean(3);
boolean enableRemoteAudio = args.getBoolean(4);
boolean enableNetworkQualityReporting = args.getBoolean(5);
view.connectToRoomWrapper(roomName, accessToken, enableAudio, enableVideo, enableRemoteAudio, enableNetworkQualityReporting);
boolean dominantSpeakerEnabled = args.getBoolean(6);
view.connectToRoomWrapper(roomName, accessToken, enableAudio, enableVideo, enableRemoteAudio, enableNetworkQualityReporting, dominantSpeakerEnabled);
break;
case DISCONNECT:
view.disconnect();
Expand Down Expand Up @@ -161,7 +163,8 @@ public Map getExportedCustomDirectEventTypeConstants() {
ON_PARTICIPANT_ENABLED_AUDIO_TRACK, MapBuilder.of("registrationName", ON_PARTICIPANT_ENABLED_AUDIO_TRACK),
ON_PARTICIPANT_DISABLED_AUDIO_TRACK, MapBuilder.of("registrationName", ON_PARTICIPANT_DISABLED_AUDIO_TRACK),
ON_STATS_RECEIVED, MapBuilder.of("registrationName", ON_STATS_RECEIVED),
ON_NETWORK_QUALITY_LEVELS_CHANGED, MapBuilder.of("registrationName", ON_NETWORK_QUALITY_LEVELS_CHANGED)
ON_NETWORK_QUALITY_LEVELS_CHANGED, MapBuilder.of("registrationName", ON_NETWORK_QUALITY_LEVELS_CHANGED),
ON_DOMINANT_SPEAKER_CHANGED, MapBuilder.of("registrationName", ON_DOMINANT_SPEAKER_CHANGED)
));

return map;
Expand Down
Loading

0 comments on commit 893961b

Please sign in to comment.