-
-
Notifications
You must be signed in to change notification settings - Fork 338
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
feat: use background-color from video element css #586
Conversation
Not working as expected see comment and video here: #583 |
Please remove your "This adds a new subview to the webView which we ensure is always behind the webView and video views." This is unnecessary, just change the color of the videoView. As it break HTML over video capability using zIndex -1. |
Please test with https://github.com/cordova-rtc/cordova-plugin-iosrtc-sample and provide capture, you can thank @AleksandarTokarev for testing the initial PR. |
Let me know if i need to do any testing when changes are made. |
Thank you @calebboyd , if you can rebase/merge master of not done already, like that @AleksandarTokarev can test :) Thank you. |
Maybe u guys can make a custom branch out of these newest changes |
Once this PR is sync with master, to include 6.0.15 fixes you can do that do test it:
That the beauty of git and npm/cordova in action :) |
Sure, let me know when master is merged into this branch |
I had rebased it already, should be good to go |
I removed the superview concept. It had been working with the sample (as well as in my own application with HTML over video). I think I did have a bug with the zPositioning not applying the global minimum to the superview "fill" layer (If one iosrtcVideo was behind the webview and one was in front), this is likely what you saw @AleksandarTokarev I had added the superview originally to support setting the plugin's background to a specified color (other than clear). Because we have to make that concession in order to support HTML over the video. It might make more sense to add this with a different api altogether, rather than the videos' css |
Thank you @calebboyd for your contribution. |
@calebboyd @hthetiot In this second video - i have put Also notice the 'stretching' of the video that is being done in the above 2 videos initially - this is not happening on 6.0.11 What i think would be the best UI/UX would be version 6.0.11 - see video in #583 (comment) (which does not have any black screen at any time), combined with the video stream fix on both sides in 6.0.15. |
@hthetiot @AleksandarTokarev what do you think if we were to add a new plugin method for setting the background color of a fullScreen UIView, and then initializing the video elementViews to clear. Then the video css would kick in once the stream was available (maybe we can do that earlier?). In the meantime the UIViews configured background color would show through. This was my intent with the superview piece.. since we're forcing the webview to be clear we need something that we can configure to replace it
If we can get the video css earlier -- It might be most frictionless (no api needed) to use the bottommost (zPos) video's configured background color... 🤔.. or even use the body's background-color since it gets |
@calebboyd I am not really versed into Native Code and inner workings of Webview so i dont think i can give a proper comment on this one. But from your drawing, i think we would want initially to be clear and after that set the background color (or in my case dont do anything - just fill the video element with the stream) |
The PR look good, let me check again. Off topic: On master I made a SHIM of canvas context drawimage video tag, I think you also.used render.save before you may want to check that @calebboyd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@calebboyd I'm not sure about the full feature set that you want to implement in the end. But ideally you should if not change current behavior for the user/ community.
I'm sure you can make change to have the iosRTC sample app working with same behavior with html over video, that all that matters to me.
If a flag is needed check the implementation of the flag ANUAL_INIT_AUDIO_DEVICE
995eaaf#diff-6813833f33103dfcaa583d4f09e06dc84c0ce8ddd34c8b567b56c9728be58389
@@ -233,6 +234,9 @@ class PluginMediaStreamRenderer : NSObject, RTCEAGLVideoViewDelegate { | |||
} | |||
|
|||
self.elementView.layer.cornerRadius = CGFloat(borderRadius) | |||
let rgb = backgroundColor.components(separatedBy: ",").map{ CGFloat(($0 as NSString).floatValue) / 256.0 } | |||
let color = UIColor(red: rgb[0], green: rgb[1], blue: rgb[2], alpha: 1) | |||
self.elementView.backgroundColor = color | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
backgroundColorRgba[3] = '0'; | ||
this.element.style.backgroundColor = 'rgba(' + backgroundColorRgba.join(',') + ')'; | ||
backgroundColorRgba.length = 3; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sounds good. I don't plan on changing any behavior. Mostly just trying to make the plugin more congruent with browser behavior. The defaults here will remain the same (black) or more specifically, computedStyle for backgroundColor if not set, is black |
Let see how it goes, if it cause issue I will revert. |
work as expected on master and sample. |
reopening due to #580 being closed
This adds a new subview to the webView which we ensure is always behind the webView and video views.In the refresh cycle it updates the background color, setting the alpha channel to 0 on the HTML video
and the Element View and element background color to the passed rgb value.