Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

alexthewilde
Copy link

See original issue #46
Fix adapted from #48

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);
Copy link
Owner

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?

@brandly
Copy link
Owner

brandly commented Jul 18, 2015

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') {
Copy link
Owner

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?

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?

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?

Copy link

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

@brandly
Copy link
Owner

brandly commented Aug 27, 2015

hey, @alexthewilde! take a look at my comments when you get a chance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants