-
Notifications
You must be signed in to change notification settings - Fork 147
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
Use an existing player if present when video changes. #61
base: master
Are you sure you want to change the base?
Conversation
if (obj == null) return true; | ||
if (Object.keys) return Object.keys(obj).length == 0; | ||
var keys = []; | ||
for (var key in obj) if (_.has(obj, key)) keys.push(key); |
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.
can we do obj.hasOwnProperty(key)
instead of the underscore dependency?
i haven't pulled this down and tested things out yet, but this looks like the right approach! thanks a lot for the help 🌟 |
|
||
function loadPlayer () { | ||
if (scope.videoId || scope.playerVars.list) { | ||
// If present, use an existing player | ||
if(scope.player && !isEmpty(scope.player) && scope.player.getIframe() && scope.player.cueVideoById === 'function') { |
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.
what does this getIframe()
check do?
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.
Thanks for all of your hard work here @brandly @alexthewilde. scope.player.cueVideoById === 'function'
doesn't work for me. It causes the check for the preexisting player to fail when a valid player is instantiated. I think you might mean (typeof scope.player.cueVideoById === 'function')
here?
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.
@brandly I believe this method returns the DOM node for the embedded iframe, maybe the intention is to make sure that it exists/is loaded?
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.
The getiframe function doesn't exists. I guess alex forget this one to include
hey, @alexthewilde! take a look at my comments when you get a chance |
See original issue #46
Fix adapted from #48