tylerpearson / lazyYT

A jQuery plugin to lazy load those dang Youtube iframe videos.
Other
208 stars 86 forks source link

Option to suppress suggestions at the end of playback? #44

Open mgrn0 opened 9 years ago

mgrn0 commented 9 years ago

Is there please an option (or an idea of how to) suppress the video suggestions at the end of video playback?

manyk commented 9 years ago

Add rel=0 as option to the youtube url.

mgrn0 commented 9 years ago

thx, but i meant it would be nice to have this as an option in the jQuery Plugin call itself…

Daugilas commented 9 years ago

@mgrn0 good notice. Actually it is already available to pass params, but only via data-parameters attribute of video container like here: <div class="js-lazyYT" data-youtube-id="156iOcnJdbw" data-parameters="rel=0"></div>

But I've just pushed a new commit (https://github.com/Daugilas/lazyYT/commit/6a41d4db38b45bea5559a54636e27c6ef121bd2e) adding this in plugin initialization:

$('.item.even .js-lazyYT').lazyYT('AIzaSyCawA87g_pgTbSNPhiWAemy-mFKszJGl4M', {
  display_duration: true,
  youtube_parameters: 'rel=1&controls=0'
});

And I am all for users concentrating on the content so in the newest version 1.1.1 I've made 'rel=0' a default parameter.

P.S. data-parameters in the container will override, but not replace youtube_parameters in initializatin. Meaning if you have youtube_parameters: 'rel=1&controls=0' on init and data-parameters="rel=0" in the container - the effective parameters will be: rel=0&controls=0.

P.P.S. the latest version is here: https://github.com/Daugilas/lazyYT

marvindanig commented 9 years ago

@Daugilas I see that your repo doesn't have a tab to report issues. So posting here thinking that the new version will be merged back soon.

I am getting a few errors on Chrome when I click play on this demo: http://works.daugilas.com/lazyYT/demo/fluid.html

GET chrome-extension://boadgeojelhgndaghljhdicfkmllpafd/cast_sender.js net::ERR_FAILEDoj @ www-embed-player.js:150nj @ www-embed-player.js:150mj @ www-embed-player.js:150pj @ www-embed-player.js:151nl @ www-embed-player.js:204zo @ www-embed-player.js:300Kq @ www-embed-player.js:339(anonymous function) @ _oEA18Y8gM0?&rel=0&autoplay=1:10
www-embed-player.js:150 GET chrome-extension://dliochdbjfkdbacpmhlcpmleaejidimm/cast_sender.js net::ERR_FAILEDoj @ www-embed-player.js:150nj @ www-embed-player.js:150(anonymous function) @ www-embed-player.js:150c.onerror @ www-embed-player.js:150
www-embed-player.js:150 GET chrome-extension://hfaagokkkhdbgiakmmlclaapfelnkoah/cast_sender.js net::ERR_FAILEDoj @ www-embed-player.js:150nj @ www-embed-player.js:150(anonymous function) @ www-embed-player.js:150c.onerror @ www-embed-player.js:150
www-embed-player.js:150 GET chrome-extension://fmfcbgogabcbclcofgocippekhfcmgfj/cast_sender.js net::ERR_FAILEDoj @ www-embed-player.js:150nj @ www-embed-player.js:150(anonymous function) @ www-embed-player.js:150c.onerror @ www-embed-player.js:150
www-embed-player.js:150 GET chrome-extension://enhhojjnijigcajfphajepfemndkmdlo/cast_sender.js net::ERR_FAILEDoj @ www-embed-player.js:150nj @ www-embed-player.js:150(anonymous function) @ www-embed-player.js:150c.onerror @ www-embed-player.js:150
www-embed-player.js:150 GET chrome-extension://eojlgccfgnjlphjnlopmadngcgmmdgpk/cast_sender.js net::ERR_FAILEDoj @ www-embed-player.js:150nj @ www-embed-player.js:150(anonymous function) @ www-embed-player.js:150c.onerror @ www-embed-player.js:150
html5player.js:233 GET https://googleads.g.doubleclick.net/pagead/ads?sdkv=h.3.0.0&sdki=405&video_…nLojfuxrQ&ref=http%3A%2F%2Fworks.daugilas.com%2FlazyYT%2Fdemo%2Ffluid.html net::ERR_BLOCKED_BY_CLIENTf.send @ html5player.js:233Z_ @ html5player.js:1183hba @ html5player.js:1181h0.o @ html5player.js:1188i0 @ html5player.js:1187h0.fetch @ html5player.js:1187rba @ html5player.js:1189(anonymous function) @ html5player.js:1190m0 @ html5player.js:1190l0 @ html5player.js:1190uba @ html5player.js:1190t2 @ html5player.js:1319f.Lj @ html5player.js:1492f.load @ html5player.js:1486a6 @ html5player.js:1515f7 @ html5player.js:1531bda @ html5player.js:1530z7 @ html5player.js:1562f.create @ html5player.js:1555p$ @ html5player.js:1785f.nE @ html5player.js:1788f.O @ html5player.js:127ql.O @ html5player.js:140m4 @ html5player.js:1420f.oo @ html5player.js:1394f.O @ html5player.js:127ql.O @ html5player.js:140f.yj @ html5player.js:443f.MA @ html5player.js:451(anonymous function) @ html5player.js:136k @ html5player.js:133
html5player.js:233 GET https://googleads.g.doubleclick.net/pagead/ads?sdkv=h.3.0.0&sdki=405&video_…nLojfuxrQ&ref=http%3A%2F%2Fworks.daugilas.com%2FlazyYT%2Fdemo%2Ffluid.html net::ERR_BLOCKED_BY_CLIENT

Thanks!

Daugilas commented 9 years ago

Hey @marvindanig thanks for the report, and I've opened issues tab in my repo as well: https://github.com/Daugilas/lazyYT/issues !

The errors that you're receiving does not come from LazyYT plugin. They come from your browser. The last two with ERR_BLOCKED_BY_CLIENT are from AdBlock++ plugin. Others I am not sure, but they appear when YouTube functionality starts (after you click play). I am positive that you'll get the same errors if you'll use standard YouTube embeds. So can't really help here, but those errors are harmless.