Skip to content
This repository has been archived by the owner on Jan 18, 2023. It is now read-only.

#50 - Update the view when <video> elements are added or removed from the DOM (or when it's style or any parent style changes) #59

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

wolfenrain
Copy link

Solves #50

@wolfenrain wolfenrain changed the base branch from 3.2.0 to master May 1, 2018 08:50
…entok into issue-50

# Conflicts:
#	src/js/OTPublisher.coffee
#	src/js/OTSession.coffee
#	src/js/OTSubscriber.coffee
#	www/opentok.js
@mark-veenstra
Copy link

@msach22 Can we get this one out? Maybe in a 3.4.0?

@msach22
Copy link

msach22 commented Jun 12, 2018

@wolfenrain @mark-veenstra If possible, could you please update the PR so we can get this merged in!

This would be great for 3.4.0 release

…entok into issue-50

# Conflicts:
#	src/js/OTSubscriber.coffee
#	www/opentok.js
@msach22 msach22 changed the base branch from master to 3.4.0 June 14, 2018 23:52
Copy link

@msach22 msach22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Requesting some minor changes regarding and undefined error and logging. Otherwise, the PR looks great.

@@ -18,7 +18,7 @@ class TBPublisher
constructor: (one, two) ->
@sanitizeInputs(one, two)
pdebug "creating publisher", {}
position = getPosition(@pubElement)
@position = getPosition(@pubElement)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this line changes position to this.position lines 36 and 37 should also change to position to this.position.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 37 and 37 have been changed to use the @position

@dispatchEvent(new TBEvent("sessionConnected"))
@connection = new TBConnection( event.connection )
@connections[event.connection.connectionId] = @connection
event = null
return @
sessionDisconnected: (event) =>
pdebug "sessionDisconnected event", event
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this, we do not need to log this event.

position = getPosition(@element)
ratios = TBGetScreenRatios()
OT.getHelper().eventing(@)
Cordova.exec(TBSuccess, TBError, OTPlugin, "subscribe", [stream.streamId, position.top, position.left, width, height, zIndex, subscribeToAudio, subscribeToVideo, ratios.widthRatio, ratios.heightRatio] )
Cordova.exec(@eventReceived, TBSuccess, OTPlugin, "addEvent", ["subscriberEvents"] )

eventReceived: (response) =>
@[response.eventType](response.data)
pdebug "subscriber event received", response
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this because this causes issues with stats events which are fired constantly. We don't need to log to the console each time we receive this event.

@@ -166,7 +164,11 @@ class TBSession
# event listeners
# todo - other events: connectionCreated, connectionDestroyed, signal?, streamPropertyChanged, signal:type?
eventReceived: (response) =>
@[response.eventType](response.data)
pdebug "session event received", response
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this line, we don't need to log these events

@msach22
Copy link

msach22 commented Jul 2, 2018

@wolfenrain @mark-veenstra It looks like this PR would break any Android device using API Level 16 or many other newer versions for that matter. It looks like MutationObserver has just been commoditized in the recent versions and will break applications that are using and older version for Android. Based on this, I'm very hesitant to merge this PR.

https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver#Browser_compatibility

@mark-veenstra
Copy link

@msach22 Regarding the MutationObserver we are using this solution already in production since we migrated to TokBox. And it is working great, as is, from Android 5 and up as we know since we tested this. So I am a bit surprised about the compatibility they claim here (even if you look into the old compatibility tables on that website).

But on the compatibility table they also state that when you want support from Android API level 18 to 26 you can use the vendor prefix WebKit. So if we want to be absolutely sure we could say: var MutationObserver = MutationObserver || WebKitMutationObserver. Then it should be no problem at all, but as I said above on this moment it is not necessary to get it working on these API levels. @wolfenrain can you add this extra check?

Also note that Cordova is only supporting API level 19 ( Android 4.4) - 27 (Android 8) from the most recent version. See this link: https://cordova.apache.org/docs/en/latest/guide/platforms/android/#requirements-and-support. They also will dropped support when Android version dip below 5% on Google's distribution dashboard.

So Android level 16 is even not supported by the most recent Cordova version. Also the market share of API level 16 and 17 is too small to keep it supported, that is why Cordova dropped it also.

This PR helps you to update the views automatically. For everyone that has an unsupported WebView or browser they still can use the old API by calling updateViews() themselves.
So why shouldn't we merge it in, with the change mentioned before?

@wolfenrain
Copy link
Author

@msach22 @mark-veenstra Changes have been made, also implemented the check for MutationObserver, if we want to have more coverage we could implement a bigger shim, but as @mark-veenstra mentioned Cordova itself doesn't support lower then API level 19, so I dont see a direct use for it.

@msach22
Copy link

msach22 commented Jul 3, 2018

@wolfenrain @mark-veenstra Thanks for your comments. The OpenTok Android SDK supports Android API level 16 and above and this plugin currently supports Cordova 3.5.0 and above. This means that we would have to do a breaking change to add this functionality.

I would really like to see this feature get merged in because I think it would make using the plugin easier, but we cannot drop support for Android 16.

@mark-veenstra
Copy link

@msach22 If you still want to support API level 16 (Android 4.1.x) and 17 (Android 4.2.x), then this PR is blocking it. I understand you will not merge this in if this is the business decision.

But we can keep it open for users who want a seperate solution and merge it in themselves. Or when you drop support for those old versions, then it can be merged as well.

@msach22
Copy link

msach22 commented Jul 9, 2018

@wolfenrain @mark-veenstra Yes, unfortunately I cannot merge this in, but I will leave this open in case developers want to add it to their forks. Thanks again for the great PR!

@msach22
Copy link

msach22 commented Dec 17, 2018

@mark-veenstra @wolfenrain Do you think we can add conditional observers where if the platform is the supported version we can use this observer, if not they will not have this functionality?

@wolfenrain
Copy link
Author

wolfenrain commented Dec 17, 2018 via email

@msach22
Copy link

msach22 commented Dec 17, 2018

@wolfenrain Yea having a polyfill might be the best approach. Let me know what you think

@wolfenrain
Copy link
Author

wolfenrain commented Jan 7, 2019

As I said here we could use that polyfill. Haven't done an indepth look. But it does provide us with the functionality needed.

@mheap mheap changed the base branch from master to main March 22, 2021 09:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants