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

build: add support for Facebook videos. As Facebook doesn't provide a… #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions angular-fluidVid.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ angular.module('tinacious.fluidVid', [])
}

if (!videoType) {
$log.error('Specify type, either \'youtube\' or \'vimeo\'');
$log.error('Specify type, either \'youtube\', \'vimeo\' or \'facebook\'');
}

// video code based on video type
Expand All @@ -27,7 +27,11 @@ angular.module('tinacious.fluidVid', [])
case 'vimeo':
videoCode = '<iframe src="http://player.vimeo.com/video/' + videoId + '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
break;


case 'facebook':
videoCode = '<iframe src="https://www.facebook.com/plugins/video.php?href=' + videoId + '" width="400" height="400" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true" allowFullScreen="true"></iframe>';
Copy link
Owner

Choose a reason for hiding this comment

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

The existing code style should be respected re: attribute value assignment for the iframe, e.g. allowFullscreen rather than allowFullscreen="true". It is generally best practice to follow the existing file's code style when contributing to an open-source project.

You have also added inline styles—border: none; is a style choice rather than required for the video to render. Why was overflow: hidden added? If neither of these are required for the functioning of Facebook video, please remove, otherwise add some spaces to make the declarations more readable.

Also, please remove the counter-productive width and height attributes—these are overwritten by the JavaScript code, and the whole point of this plugin is to not have hard video dimensions. These are redundant and can be confusing to anyone else reading the code because there is no point in adding attributes that get overridden.

break;

default:
$log.error('Sorry, the type "' + videoType + '" is not currently supported. Please use either \'youtube\' or \'vimeo\'');
}
Expand Down