MLLEmbed, or by it's module name mll.embed
, is a script that turns YouTube embeds into MovieLaLa embeds.
It looks for IFRAMEs and changes their URLs.
For example, this url:
http://www.youtube.com/embed/bo36MrBfTk4?autoplay=1
will become:
http://embed.movielala.com/embed/bo36MrBfTk4?autoplay=1&clientId=YourCompany
You have four options:
For Advanced RequireJS
Compatibilty with Youtube IFrame
//Configuration Cloudflare powered CDN with 50+ POPs
<script src="https://assets-embed.movielala.com/mllembed.min.js"></script>
<script>
//Configuration
mllembed.config('clientId', 'YourCompany');
</script>
<script>
!function(e, t, n, s) {
'use strict';
var c, m = t.createElement(n), a = t.getElementsByTagName(n), r = a[0];
m.async = !0, m.src = s, r.parentNode.insertBefore(m, r), c = function() {
c.stack.push(arguments);
}, c.stack = [], e.mllembed = c;
}(window, document, 'script', 'https://assets-embed.movielala.com/mllembed.min.js');
//Configuration
mllembed('config', 'clientId', 'YourCompany');
</script>
MLLEmbed automatically runs on DOMContentReady
and load
. If you are add iframes after, you can handle them like this:
//Append iframe
$('#mycontainer').append('<iframe src="http://www.youtube.com/embed/bo36MrBfTk4"></iframe>');
//Run MLLEmbed
mllembed.run();
If you already have a YouTube IFrame API implementation, all you have to do is replace the URL of IFrame API with "https://assets-embed.movielala.com/iframe_api". There is no need to use MLLEmbed.
This is the original youtube loader code:
<script>
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
</script>
All you have to do is change the URL:
<script>
var tag = document.createElement('script');
tag.src = "https://assets-embed.movielala.com/iframe_api"; //Changed
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
</script>
Please make sure you follow the documentation exactly if you decide not to use recommended techniques.
- Be sure you have Node.js installed.
- Checkout the repository.
npm install
.gulp
No tests yet.