embeded youtube videos not showing

embeded youtube videos not showing

by rene diaz -
Number of replies: 29

I recently upgraded to moodle 2.7 and the the 2.7 theme (a few weeks ago). When I embed youtube videos  by coping and pasting the iFrame code into the HTML text edit the videos do not show. Only a white "box" with an error message.

But it still shows the youtube videos I previously added back in the 2.5 and 2.6 theme version. Please help. 


The image is how it looks on safari

Attachment Screen Shot 2014-10-05 at 12.32.21.png
Average of ratings: -
In reply to rene diaz

Re: embeded youtube videos not showing

by rene diaz -

His is how it looks on firefox

Attachment Screen Shot 2014-10-05 at 12.33.05.png
In reply to rene diaz

Re: embeded youtube videos not showing

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

You should use the 'Insert media' -> 'Browse repositories' -> 'YouTube videos' option in the editor instead for inserting YouTube videos.

In reply to Gareth J Barnard

Re: embeded youtube videos not showing

by rene diaz -

I do not want to use  the 'YouTube videos repository' because of its many limitations. I want to use the iFrame that allows for editing. Such as changing the size, borders and many of the other useful possibilities when working with the iFrame within HTML.  Instead the YouTube videos repository actually just pasts a link to the video. 


In reply to rene diaz

Re: embeded youtube videos not showing

by Usman Asar -
Picture of Plugin developers Picture of Testers

Rene, which Activity are you using to embed videos? As I have had no problems embedding them in PAGE activity, it shows up as it should. 

Besides, what I believe you are inserting the code into the WYSIWYG editor, you have to select code view (HTML Editor) to paste the iframe code.

In reply to Usman Asar

Re: embeded youtube videos not showing

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Additionally to the good advice of Usman, do you have any filters that are turned on and affecting the output of the text editor?

In reply to rene diaz

Re: embeded youtube videos not showing

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

I don't believe the 'YouTube videos repository actually just pasts a link to the video' It embeds the video in the page in a standard size layout which is put in place by a filter which takes that link and turns it into the embedded video on your page without you needing to go into any of the html or copy and paste iframe code etc.

You may need to check you have the correct filters properly enabled and that none are clashing with each other.

Average of ratings: Useful (1)
In reply to Richard Oelmann

Re: embeded youtube videos not showing

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

I agree about using the Moodle media filter and getting your youtube video that way, but if you do want to paste the embed code and are having trouble displaying it, have you tried ticking the box "Use old embed code" in the "More" section when you click to share/embed your video on its youtube page? I've found videos display with the old embed code if they don't with the regular iframe code. (But then you will probably not get the HTML5 option......)

In reply to rene diaz

Re: embeded youtube videos not showing

by rene diaz -

Thanks for all the responses . Ill just add them all in here.


1 This is the embed code:

<iframe src="//www.youtube.com/embed/BUNcQMP2gwE" allowfullscreen="" frameborder="0" height="315" width="420"></iframe>

2 Yes I am pasting it in the HTML section.  I have been using the HTML since 2.2 (maybe even 2.1) this is the first time I am having this issue.

3 'YouTube videos repository actually just pasts a link to the video'. In the HTML it is what shows I do know what it does in the back end . However, what I want is the iFrame so I can tweak it as I normally do.

4 Yes I also had selected the box "Use old embed code" (I was almost sure that was the problem when the problem uncured. but I was proven wrong) sad

5 which filters should I check to see if they are affecting it?

6 I am pasting it in the "Labels" Resource


Thanks again everyone!

In reply to rene diaz

Re: embeded youtube videos not showing

by Usman Asar -
Picture of Plugin developers Picture of Testers

Rene, I have used your code as it is typed, and used it in LABEL as well as PAGE, it worked flawless in both cases with me, screenshots attached. 

Below, used as Label:



and used in Page below


in both my cases, it worked absolutely fine, are you sure you are using the "<>" code view to embed the images? 

As well, have you checked "YouTube" in Media Embedding? Administration > Themes > Media Embedding


Average of ratings: Useful (2)
In reply to Usman Asar

Re: embeded youtube videos not showing

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Usman,

The path for the Media Embedding which you gave is incorrect it should be...

Administration> Site administration > Appearance > Media embedding

Thanks

Mary

In reply to Mary Evans

Re: embeded youtube videos not showing

by Usman Asar -
Picture of Plugin developers Picture of Testers

My bad Mary, just had a look once again thinking that it may be changed in 2.8 as I have tested rene's code on my moodle 2.8 and its the same, so you're right as usual wink 

Hope it solves Rene's issue. I am sure she is actually typing the URL in Editor window rather than code window, as embedding YouTube in editor window always shows up the URL of YouTube rather than the actual embed.

In reply to Usman Asar

Re: embeded youtube videos not showing

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Usman -you can paste the URL of a youtube video into the WYSIWYG editor and it will embed the youtube video in its player as desired as long as you have multimedia plugins enabled (and if you have the Convert URLs into links filter on then that will convert the pasted URL into the link needed for the multimedia filter to work.)

In reply to Usman Asar

Re: embeded youtube videos not showing

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Usman,

It is quite evident Rene has been doing this correctly for a number of years, and so we have to respect that, however things have changed in 2.7 and since Rene has recently upgraded to 2.7, it is not surprising some things do not work the same way.

I am just hoping that the Moodle Doc proves to be useful.

Cheers

Mary

In reply to rene diaz

Re: embeded youtube videos not showing

by rene diaz -

I looked in Administration > Appearance > Themes > Media Embedding

And it is in the Default setting: "Yes" = YouTube video sharing site, video and playlist links supported.

Quick note René is a He = I am male (Reneé would be a she) . Also as i have been repeating over and over again I am not typing the URL in the WYSIWYG editor window. I am copying and pasting the code into the HTML code window = "<>" code view as I have always done.  In fact before writing this post I have even copied and pasted the same iFrame embed code from the working labels I did in 2.6 and 2.5 since they are still working.  So the code I also pasted here before does work but in the past. The code is not broken.

So the issues is not the embedded code itself or where it is being placed and the  "Media Embedding" settings are on. Not sure what it is but some outside the box thinking might be the solution which I;m also working on to resolves this. So any in site from this perspective would be useful. Thanks again.

In reply to rene diaz

Re: embeded youtube videos not showing

by rene diaz -

Also when I do past the code eg:

<iframe width="560" height="315" src="//www.youtube.com/embed/TPf1E1Hbe2o" frameborder="0" allowfullscreen></iframe>

 into the HTML code window = "<>"

I shows and can play the video with in the WYSIWYG editor window

However, in the course is display the following error which I also pasted a screen shop here before:

"Server not found 

Firefox can't find the server at %3ca%20href=.     

Check the address for typing errors such as ww.example.com instead of www.example.com     If you are unable to load any pages, check your computer's network connection. If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web"

There is no firewall or proxy set up. 

In Safari the image is blank as in the screen shot I also provided.

So it shows in the WYSIWYG editor window that is is reading the embed code, Just that is it not displaying it in the course.



In reply to rene diaz

Re: embeded youtube videos not showing

by Usman Asar -
Picture of Plugin developers Picture of Testers

OK cool, apologies with refereing to as "she", thanks for sorting it out.

now with all the information from your side to be fulfilled in terms of filters/embedding as they should be, is YouTube opening at your end? I meant to say it may not be blocked by Firewall rules or something, can you show the site where you are actually embedding? as per your screens it does takes the space to show the video, but then it doesn't downloads the player, that can only happen in case of YouTube being blocked.

In reply to rene diaz

Re: embeded youtube videos not showing

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi,

I have just tested this in Moodle Sandbox as a teacher I added the code in a label and saved it but it did not show, so I logged out and logged in again as Admin.

Returning to the course page the video worked...so I am wondering if this is a bug? Could it be role related?

In reply to rene diaz

Re: embeded youtube videos not showing

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Rene,

Can you paste the code you are using here? You may be adding something that is wrong, or perhaps copied it wrongly in the first place?

Thanks

Mary

In reply to Mary Evans

Re: embeded youtube videos not showing

by Ernesto Ramírez D. -

René,

Copy/Pasting code sometimes intro hidden or invisible garbage code in you system. Sometimes when I can't find an explanation for an error like this, this is what works for me:

I copy the code from source and paste it in a simple text word procesor like notepad (I use a very powerful yet simple to use Textwrangler)  which can manage text without converting it to rich-text. Then I copy it again and paste in my code window...and voilá

I hope it works for you


Regards,

Ernesto R.

In reply to Mary Evans

Re: embeded youtube videos not showing

by Katherine Nguyen -

Hi Mary,

I have had a similar issue with embed code. But it only happens on Front page content area. Please see the attached screenshot. The video displays in the editor. But after saving it, it does not show on front page. 

I'm using Moodle 2.7 and Essential theme 2.7.

Could you please help?

Many thanks,

Katherine

Attachment screenshot.jpg
In reply to Katherine Nguyen

Re: embeded youtube videos not showing

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

If you swap to another theme can you embed the video ... .?

In reply to Mary Evans

Re: embeded youtube videos not showing

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

I'm fairly certain that the Marketing spots have a filter to support multi-lang which may strip out 'iframe' tags.  Off the top of my head I cannot remember the current state and if this has been fixed.  Version 2.7 is incredibly old and lots have happened since then.

In reply to Gareth J Barnard

Re: embeded youtube videos not showing

by Katherine Nguyen -

Hi Mary and Gareth,

Thanks for getting back to me so quickly. 

My Moodle version is 2.7.3+

I have just upgraded the Essential theme to latest version which is 2.7.9.1. The video is still not showing.

The embed iframe works for me on other places (i.e. site summary, course summary, etc.), but it does not work in Essential theme front page settings. Please see the attached screenshot. I embed the same video in 3 places:  front page content area, marketing spot one, and site summary. The video only shows in site summary area.


Attachment screenshot_frontpg.jpg
In reply to rene diaz

Re: embeded youtube videos not showing

by Marc Couture -

I found this older thread after searching for a solution to a similar problem with external videos embedded in iframes on Pages or Books.  We also use Essential and thought it could be related to the theme's settings, or incorrect HTML source code parameters.

In our case, the solution was quite simple: add "s" to "http" in the video resource's URL. 

You guessed it: the problem was introduced by us when we set up our server to secure all connections by default on our server...  Lesson learned!

Cheers,

Marc C.

Average of ratings: Useful (1)
In reply to Marc Couture

Re: embeded youtube videos not showing

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Marc,

Thanks for sharing this...glad you got it fixed eventually.

Cheers

cheers!

Mary

In reply to Marc Couture

Re: embeded youtube videos not showing

by Janis Fair -

Thanks for posting this Marc! You have solved this problem for us too. big grin

Cheers!
Janis