Browse Source

adding js mediaelementplayer for videos within iframes

Alex Aragón 6 năm trước cách đây
mục cha
commit
2813938fe2

+ 11 - 0
main/inc/lib/javascript/iframe-js-loader.js

@@ -0,0 +1,11 @@
+$(document).ready(function() {
+    //get the path to mediaelement plugins
+    var scripts = document.getElementsByTagName('script');
+    var scriptPath = scripts[scripts.length-1].src;
+    var basePath = scriptPath.substring(0, scriptPath.indexOf('/main/')+1) + 'web/assets/mediaelement/build/';
+    $('video:not(.skip), audio:not(.skip)').mediaelementplayer({
+        pluginPath: basePath,
+        shimScriptAccess: 'always'
+        // more configuration
+    });
+});

+ 4 - 1
main/template/default/learnpath/view.tpl

@@ -293,7 +293,10 @@
                         {type: 'stylesheet', id: '_fr5', src: '{{ _p.web }}web/assets/jquery-ui/themes/smoothness/jquery-ui.min.css'},
                         {type: 'stylesheet', id: '_fr6', src: '{{ _p.web }}web/assets/jquery-ui/themes/smoothness/theme.css'},
                         {type: 'script', id: '_fr2', src: '{{ _p.web_lib }}javascript/jquery.highlight.js'},
-                        {type: 'script', id: '_fr3', src: '{{ _p.web_main }}glossary/glossary.js.php?{{ _p.web_cid_query }}'}
+                        {type: 'script', id: '_fr3', src: '{{ _p.web_main }}glossary/glossary.js.php?{{ _p.web_cid_query }}'},
+                        {type: 'script', id: '_media1', src: '{{ _p.web }}web/assets/mediaelement/build/mediaelement-and-player.min.js'},
+                        {type: 'stylesheet', id: '_media2', src: '{{ _p.web }}web/assets/mediaelement/build/mediaelementplayer.min.css'},
+                        {type: 'script', id: '_media3', src: '{{ _p.web_lib }}javascript/iframe-js-loader.js'}
                     ]
                 });
             }