-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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/ui custom castproxy #2464
Feat/ui custom castproxy #2464
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
I have some technical feedback around what looks like some compiler issues, but first let's discuss your goals with this change. What are the main goals of a custom CastProxy? |
I have a project where I would like to use the stock ui, with some minor modifications. One of the modifications being the Chromecast sender implementation. I now can use a custom CastProxy sender implementation, using CAF v3 api's. This works fine for me, using this additional argument for shaka.ui.Overlay. Though, I'm struggling a bit on how to make closure compiler cope with this externally defined castproxy, and make it a good general addition to the project. |
Yeah, the compiler is difficult sometimes. I'll leave you some specific technical feedback on the changes about the compiler. Hopefully we'll be able to help you resolve that. I'm open to this change generally, but I wonder if you'd be willing to share your CAF v3 implementation with us as well. Does it use CAF on the sender side instead of the older Cast SDK? Does it still expect Shaka Player on the receiver side, or does it use the CAF default receiver? |
@@ -0,0 +1,56 @@ | |||
|
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.
When you define externs, you need to have a block comment containing @externs
at the top. Please copy the copyright header and @externs
block comment from another extern file.
Without that, this file will not be seen as an "external" interface from the environment, and pieces of the implementation can still be renamed and inlined. I see you are using ['foo']
style to avoid renaming, but inlining can't be defeated in this way.
When you fix the externs header, you should see those issues go away.
@@ -39,7 +39,7 @@ shaka.ui.CastButton = class extends shaka.ui.Element { | |||
constructor(parent, controls) { | |||
super(parent, controls); | |||
|
|||
/** @private {shaka.cast.CastProxy} */ | |||
/** @private {shaka.cast.CastProxy|shaka.extern.CastProxy} */ |
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.
Since shaka.cast.CastProxy is an implementation of shaka.extern.CastProxy, you should just use the base type here.
@@ -94,12 +94,12 @@ shaka.ui.CastButton = class extends shaka.ui.Element { | |||
|
|||
/** @private */ | |||
async onCastClick_() { | |||
if (this.castProxy_.isCasting()) { | |||
this.castProxy_.suggestDisconnect(); | |||
if (this.castProxy_['isCasting']()) { |
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.
I believe these changes to bracket notation can all be reverted once you fix the externs file.
video, player, this.config_.castReceiverAppId); | ||
|
||
/** @private {boolean} */ | ||
this.castAllowed_ = true; | ||
|
||
/** @private {HTMLMediaElement} */ | ||
this.video_ = this.castProxy_.getVideo(); | ||
this.video_ = this.castProxy_['getVideo'](); |
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.
Same here. Try reverting these changes once the externs are fixed.
@@ -675,11 +676,15 @@ shaka.ui.Controls.prototype.addControlsContainer_ = function() { | |||
this.videoContainer_.appendChild(this.controlsContainer_); | |||
|
|||
this.eventManager_.listen(this.controlsContainer_, 'touchstart', (e) => { | |||
this.onContainerTouch_(e); | |||
if (!e.defaultPrevented) { |
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.
This looks like it's probably a useful change independent of the Cast changes. What's the use case? Would you be willing to split that into a separate PR?
4629f54
to
c356903
Compare
9ae6a64
to
9f7f537
Compare
I've just noticed that you're developing against the If you'd like to continue this PR, please rebase against |
Thanks for the explanation, I'll probably handle this rebase and changes the coming week! I couldn't find any time to finish this MR due to the unexpected chain of events. My productivity plummeted, because, you know, kids ;) |
No worries! We understand, and there's no urgency from our perspective. |
b43a60c
to
af66d00
Compare
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
0d369eb
to
af66d00
Compare
Soon, we are going to work on #4214 so for now I don't think we're going to add this. If you have any suggestion tell me. |
This is an attempt at extending ui/ui.js with an optional external castProxy class.
there are still some open ends, but to start the discussion I started this pull request.
If there are any good idea's on how this should better be implemented, I love to hear them!