Supporting each other

Community forums

Welcome, Guest
Username: Password: Remember me
Report any technical problems you discover and discuss solutions.
  • Page:
  • 1

TOPIC:

v3: Bug: Playing youtu.be video fails 9 years 2 months ago #3151

  • jayaich
  • jayaich's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 82
  • Thank you received: 5
Hello,

It seems that when using a 'youtu.be' URL link directly in a page via 'Navigators->Embed Content' (when editing the project), the video does not play. For our user they get an 'Error loading' displayed, but in my test (running preview) I just got a blank page.

The problem seems to be that 'youtu.be' is not converted to a full 'youtube.com/embed' link in all cases. Although the code changed 'youtu.be/', it did not cater for 'https'.

Below are a couple of patches which worked for us. I think though that a more correct and fuller patch would be to more generically cater for http/https, and, secondly, to cater for the fact that the DNS domain in a URL can be case-independent.
diff -u ./modules/xerte/parent_templates/Nottingham/models_html5/embedDiv.html.orig ./modules/xerte/parent_templates/Nottingham/models_html5/embedDiv.html
--- ./modules/xerte/parent_templates/Nottingham/models_html5/embedDiv.html.orig 2015-07-29 23:17:23.000000000 +0100
+++ ./modules/xerte/parent_templates/Nottingham/models_html5/embedDiv.html      2015-09-18 16:29:23.250016761 +0100
@@ -63,6 +63,9 @@
                                $iFrameHolder.html(pageSrc);
                        } else { // use iframe to load web page
                                var iFrameTag = '<iframe id="iFrame" src="' + pageSrc + '" width="100%" height="' + embedDiv.calcHeight() + '"></iframe>';
+                               if (pageSrc.indexOf("youtu.be/") != -1) {
+                                       iFrameTag = iFrameTag.replace("youtu.be/", "www.youtube.com/embed/");
+                               }
                                $iFrameHolder.html(iFrameTag);
                                $iFrameHolder.addClass("centerAlign");
                        }
diff ./modules/xerte/parent_templates/Nottingham/models_html5/youtube.html.orig ./modules/xerte/parent_templates/Nottingham/models_html5/youtube.html
66c66,67
<                       else if (youtubeCode.substring(0, 16) == "http://youtu.be/") {
---
>                       else if (youtubeCode.indexOf("youtu.be/") != -1) {
>                               var idx = youtubeCode.indexOf("youtu.be/");
76c77
<                               iframe.code = youtubeCode.substring(16, finish);
---
>                               iframe.code = youtubeCode.substring(idx + 9, finish);


John.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Moderators: ronmjultenJohnSmith
Time to create page: 0.042 seconds
Copyright © 2024 The Xerte Project.
Xerte logo Apereo logo OSI Logo

Search