Skip to content

Commit

Permalink
Merge pull request #297 from opentok/0.11.0
Browse files Browse the repository at this point in the history
v0.11.0
  • Loading branch information
msach22 authored Jun 13, 2019
2 parents e11c7aa + 7419a76 commit 0ee1c8d
Show file tree
Hide file tree
Showing 9 changed files with 1,690 additions and 1,612 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,8 @@ public void onStreamDropped(Session session, Stream stream) {
public void onStreamCreated(PublisherKit publisherKit, Stream stream) {

String publisherId = Utils.getPublisherId(publisherKit);
ConcurrentHashMap<String, Stream> mSubscriberStreams = sharedState.getSubscriberStreams();
mSubscriberStreams.put(stream.getStreamId(), stream);
if (publisherId.length() > 0) {
String event = publisherId + ":" + publisherPreface + "onStreamCreated";;
WritableMap streamInfo = EventUtils.prepareJSStreamMap(stream);
Expand All @@ -572,6 +574,9 @@ public void onStreamDestroyed(PublisherKit publisherKit, Stream stream) {

String publisherId = Utils.getPublisherId(publisherKit);
String event = publisherId + ":" + publisherPreface + "onStreamDestroyed";
ConcurrentHashMap<String, Stream> mSubscriberStreams = sharedState.getSubscriberStreams();
String mStreamId = stream.getStreamId();
mSubscriberStreams.remove(mStreamId);
if (publisherId.length() > 0) {
WritableMap streamInfo = EventUtils.prepareJSStreamMap(stream);
sendEventMap(this.getReactApplicationContext(), event, streamInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public static WritableMap prepareJSStreamMap(Stream stream) {
streamInfo.putString("name", stream.getName());
streamInfo.putBoolean("hasAudio", stream.hasAudio());
streamInfo.putBoolean("hasVideo", stream.hasVideo());
if (stream.getStreamVideoType().equals(Stream.StreamVideoType.StreamVideoTypeScreen)) {
streamInfo.putString("videoType", "screen");
} else {
streamInfo.putString("videoType", "camera");
}
}
return streamInfo;
}
Expand Down
1 change: 1 addition & 0 deletions docs/OTSubscriber.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
| properties | Object | No | Properties passed into the native subscriber instance
| streamProperties | Object | No | Used to update individual subscriber instance properties
| eventHandlers | Object&lt;Function&gt; | No | Event handlers passed into the native subscriber instance
| subscribeToSelf | Boolean | No | If true, subscribe to his own stream (default: false)

## Properties
* **subscribeToAudio** (Boolean) — Whether to subscribe to audio.
Expand Down
2 changes: 2 additions & 0 deletions ios/OpenTokReactNative/OTSessionManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ extension OTSessionManager: OTSessionDelegate {
extension OTSessionManager: OTPublisherDelegate {
func publisher(_ publisher: OTPublisherKit, streamCreated stream: OTStream) {
OTRN.sharedState.publisherStreams.updateValue(stream, forKey: stream.streamId)
OTRN.sharedState.subscriberStreams.updateValue(stream, forKey: stream.streamId)
let publisherId = Utils.getPublisherId(publisher as! OTPublisher);
if (publisherId.count > 0) {
OTRN.sharedState.isPublishing[publisherId] = true;
Expand All @@ -424,6 +425,7 @@ extension OTSessionManager: OTPublisherDelegate {
func publisher(_ publisher: OTPublisherKit, streamDestroyed stream: OTStream) {
OTRN.sharedState.streamObservers.removeValue(forKey: stream.streamId)
OTRN.sharedState.publisherStreams.removeValue(forKey: stream.streamId)
OTRN.sharedState.subscriberStreams.removeValue(forKey: stream.streamId)
let publisherId = Utils.getPublisherId(publisher as! OTPublisher);
OTRN.sharedState.isPublishing[publisherId] = false;
if (publisherId.count > 0) {
Expand Down
1 change: 1 addition & 0 deletions ios/OpenTokReactNative/Utils/EventUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class EventUtils {
streamInfo["creationTime"] = convertDateToString(stream.creationTime);
streamInfo["height"] = stream.videoDimensions.height;
streamInfo["width"] = stream.videoDimensions.width;
streamInfo["videoType"] = stream.videoType == OTStreamVideoType.screen ? "screen" : "camera"
return streamInfo;
}

Expand Down
Loading

0 comments on commit 0ee1c8d

Please sign in to comment.