hoyois / clicktoplugin

Prevents plug-ins from loading automatically in Safari
http://hoyois.github.com/safariextensions/clicktoplugin/
228 stars 44 forks source link

Enable youtube killer but not on youtube.com ? #168

Closed benrubson closed 8 years ago

benrubson commented 8 years ago

Hello,

Let's imagine we want to use ClickToFlash to convert embedded videos from Flash to HTML5 on forums, discussion boards... which include Youtube videos as embedded Flash content.

However how to let Youtube load its own HTML5 player on youtube.com ? Without Flash installed, and without ClickToFlash installed, youtube.com loads its own HTML5 player. But when ClickToFlash is installed, ClickToFlash overwrites youtube.com HTML5 player.

How to make ClickToFlash only act on embedded Flash videos ?

Thank you very much 👍

Ben

hoyois commented 8 years ago

There is no way to do that from within the extension. Replacing the built-in YouTube.js script with the following should do the trick:

https://raw.githubusercontent.com/hoyois/plugin-to-html5/master/YouTube-embed-only.js

benrubson commented 8 years ago

Marc, thank you very much for your answer and for your new script, it works like a charm 👍

I think you should also disable the killer for /embed/ URLs, for example, some sites use : <iframe src="https://www.youtube.com/embed/6Bo4vYgmVhk" width="700" height="392" frameborder="0" allowfullscreen="allowfullscreen"></iframe> And this of course uses the legitimate Youtube HTML5 player.

Do you think we could make this new Youtube killer the default one provided with ClickToFlash Safari extension ? As now Youtube is HTML5 by default, perhaps there is no reason to overwrite its player by the ClickToFlash one. But perhaps there is ?

Thank you again !

Ben

hoyois commented 8 years ago

All embedded YouTube videos are in such iframes. If you don't want CTP there you should simply remove the YouTube killer from the list...

benrubson commented 8 years ago

On forums etc... videos are embedded like this : <embed src="http://www.youtube.com/v/6Bo4vYgmVhk" type="application/x-shockwave-flash" height="350" width="425"> This of course requires CTF to move videos to HTML5 player.

If ever iframe is used, CTF is no more required as iframe uses the HTML5 Youtube player : <iframe src="https://www.youtube.com/embed/6Bo4vYgmVhk" width="700" height="392" frameborder="0" allowfullscreen="allowfullscreen"></iframe>

Thank you !

Ben

hoyois commented 8 years ago

I see, I didn't know these embeds were still used (YouTube's default embed code has been an iframe for a very long time now). Removing the if clause at the beginning of YouTube.js will do what you want then.

benrubson commented 8 years ago

Which one Marc ? (there are several if at the beginning of the script) May I ask you to push the modification ? Thank you very much 👍

hoyois commented 8 years ago

Try this one:

https://raw.githubusercontent.com/hoyois/plugin-to-html5/master/YouTube-no-hack.js

benrubson commented 8 years ago

Excellent Marc, it works as expected 👍 Only the Flash videos are now converted to HTML5, Youtube own HTML5 player is no more overwritten, wherever it is. Perfect !

Do you think we could make this Youtube script the default Youtube script provided with ClickToFlash Safari extension (as it is less "intrusive") ?

Thank you again !

hoyois commented 8 years ago

The current default is the result of popular demands, I'm afraid. Most users would never even encounter these old embeds.

Anyway, that's a moot point since I cannot compile the extension anymore.

benrubson commented 8 years ago

OK Marc, I did not see that you were stuck to 3.2 due to Apple's policies... Anyway, thank you very much 👍