Giter VIP home page Giter VIP logo

mike-zarandona / prettyembed.js Goto Github PK

View Code? Open in Web Editor NEW
1.1K 35.0 86.0 310 KB

Prettier embeds for your YouTubes - with nice options like high-res preview images, advanced customization of embed options, and optional FitVids support.

Home Page: http://codepen.io/mike-zarandona/full/FELxi/

JavaScript 100.00%
youtube fitvids video embed-options embed display-youtube waitforimages javascript

prettyembed.js's Introduction

Hi, I'm Mike Zarandona

I build and manage products for the web, as well as the teams and processes that effectively deliver them.

I've gained a reputation as an engineer and technical product manager with a proclivity for analytics. I have a passion for shipping code that drives business growth and delights customers. With a focus on data-driven solutions, I tackle complex technical challenges by solving for the why through qualitative and quantitative data. I have a passion for shipping early and often, and love to stay close to the customer feedback loop.

With a proven track record, I am adept at both driving product roadmaps and executing on the code that brings them to life. My focus on analytics and close attention to customer feedback ensures my teams and I are solving the right problems for both customers and business stakeholders.

mike.zarandona.com

prettyembed.js's People

Contributors

jonathanmoore avatar mike-zarandona avatar upmauro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

prettyembed.js's Issues

CSS code is generated multiple times when PrettyEmbed is used multiple times

Every time prettyEmbedis called, the following is executed:

        var div = $('<style />', { 
            id:     'pretty-embed-style',
            html:   '.elem.selector{' +
                        'position: relative;' +
                        'background-color: #000;' +
                        'cursor: pointer;' +
                    '}' + [...]
        }).appendTo('head');

This creates mutliple style tags in the head section of the document, all with the same id.

I'd suggest to either store in a boolean whether the styles have already been appended to the head, or to include a separate css file in the project.

License

Hi,

This is a great script, but I'd like to ask, what license does it fall under?

Thanks!

open in Lightbox

is there a possibility to open the video in a lightbox like fancybox?

Make image size pulled from YouTube an option

So far the library generates image urls that pull the maximum resolution of the image. It would be nice to have an option to chose which image size to pull. For smaller previews the maximum resolution preview might be unnecessary.

data-pe-show-related attribute gets ignored and forces related videos.

The obj.attr('data-pe-show-related') returns a string so the if statement always fails if
you are using attributes for driving your prettyembed.
Below is a suggested fix to move the attr to be evaluated against string vs boolean for the attribute string creation.

if ( (obj.attr('data-pe-show-related') === 'false') || (options.showRelated === false) ) { playerOptions += '&rel=0'; } else { playerOptions += '&rel=1'; }

Vertical bar, no autoplay and no loop

Hi!

Great plug-in, by the way. It's exactly what I need, except a few things.

When I play the video, it shows vertical bars on both sides of the video, and neither autoplay nor loop=1 does not seem to work. When the page loads, the video doesn't play automatically and it doesn't loop either.

  $(function(){
    $('#bgvid').prettyEmbed({
      videoID: 'some_youtube_id',
      previewSize: 'hd',

      // Embed controls
      showInfo: false,
      showControls: false,
      loop: true,

      colorScheme: 'dark',
      showRelated: false,

      useFitVids: true
    });
  });

Any help would be much appreciated.

Thank you!

PrettyEmbed on mobile devices. Bug?

I'm getting the default YouTube mobile player on mobile devices (useragent set to iPhone 3). No thumbnail - immediately showing the player. Is this the correct behavior? On desktop it works perfectly.

Mistake in the readme

Hi!
Getting Started -> Script Driven -> Call the plugin...
On the last line should be "});" instead of ")};"

:)

Small problems with successive calls of prettyEmbed

For an infinite scroll page I have to call prettyEmbed successively.

In line 59 of the non-minified version there is elem = $(this).add('.pretty-embed');. Lateron the class name pretty-embedis added to the current element. Which, with successive calls, leads to all formerly handled elements to be handled again. I ommitted .add('.pretty-embed') in line 59.

Also, for reasons I don't quite understand, the value for thisCustomPreviewImage changes from undefinedto an empty string from the second time on that the script is executed. Which let's the script run into the first branch of the if statement in line 138, causing an img element with an empty src attribute to appear.

I changed line 138 to
if ( thisCustomPreviewImage !== undefined && thisCustomPreviewImage !== '') {
as I am missing the reason for the value not staying undefined.

Otherwise, version 1.1.0 is a great improvement and works like a charm. Thanks for the effort!

Don't work with video playlist?

it work with embed playlist too??
like
iframe width="560" height="315" src="//www.youtube.com/embed/videoseries?list=PLA1BD1E862C80F959" frameborder="0" allowfullscreen></iframe

Subtitle and translate ?

hi, can this change the subtitle options and the translated options ? thanks
example:
subtitle: true
translated: spanish

Is this actually published on Bower?

❯ bs pretty
Search results:

    prettycheckable git://github.com/arthurgouveia/prettyCheckable.git
    jquery-prettyPhoto git://github.com/scaron/prettyphoto.git
    ng-prettyjson git://github.com/darul75/ng-prettyjson.git
    better-prettydate git://github.com/chemerisuk/better-prettydate
    prettyprint git://github.com/padolsey/prettyPrint.js
    jquery-prettydate git://github.com/jzaefferer/jquery-prettydate
    angular-pretty-checkable git://github.com/itslenny/angular-pretty-checkable.git
    pretty-bytes git://github.com/sindresorhus/pretty-bytes.git
    pretty-ms git://github.com/sindresorhus/pretty-ms.git
    prettyPrint git://github.com/padolsey/prettyPrint.js.git
    pretty-exponential git://github.com/bmcustodio/pretty-exponential.git
    jquery-prettyselect git://github.com/kajyr/jquery-prettyselect.git
    prettydiff git://github.com/austincheney/Pretty-Diff.git
    grunt-html-prettyprinter git://github.com/twolfson/grunt-html-prettyprinter.git
    pretty-scss git://github.com/rthor/Pretty-SCSS.git
    pretty-slider git://github.com/usmakestwo/pretty-slider-bower.git

my_blog git/master
❯ bs prettyembed
No results.

my_blog git/master
❯ bs pretty-embed
No results.

Bottom Bar does not disappear on playback

Screenshot

As you can see in the screenshot attached, during playback, the bar at the bottom disappears unless your mouse is over it in a regular embed. Thought it was worth noting.

Video ID improvement?

It would be nice (better?) if the script pulled the YouTube ID from an element, rather than it having to be defined in the script itself. For example, a link; <a href="https://www.youtube.com/watch?v=ZDdq9UhTD_k">YouTube</a> would be replaced with the container / image / iframe.

Unless I'm reading it wrong...

.selector property on jQuery objects is deprecated

PrettyEmbed.js uses elem = $(this) and later elem.selector to print out the css rules. As the selector property is deprecated, the css rules are generated without a selector.

Firefox for example automatically seems to seems to use a * selector in that case. The result is play buttons appearing on every element on the page.

I guess it would be a solution to just have the selector as an option.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.