Embed Youtube videos/Iframe in problem component.

159 views
Skip to first unread message

prashant

unread,
Feb 4, 2016, 12:02:07 AM2/4/16
to General Open edX discussion
Hello, 

In our course, after showing video to students, we ask question based on that video. 

After answering question, when student clicks 'Show Answer' button, we want to show them another video as explanation. 

When we are trying to embed video inside <solution> tag, we are getting error. (see attached screenshot)

We are curious to know is it possible to embed video inside explanation of problem component. If yes, then how?

Many thanks in advance. 

-Prashant. 
embedding iframe.png
error.png

Tony

unread,
Feb 10, 2016, 3:14:15 AM2/10/16
to General Open edX discussion
I don't believe you can embed here because the language used to build the problems are not in HTML

Leonardo Salom

unread,
Feb 10, 2016, 6:14:59 AM2/10/16
to General Open edX discussion
Maybe i'm wrong but i remember edx having conditional blocks wich can adapt his visibility to some conditions (per example solved problem x).


Check if that works for you.

Regards.

Peter Pinch

unread,
Feb 10, 2016, 8:46:38 AM2/10/16
to edx-...@googlegroups.com
There's an MIT course that embedded YouTube in solutions extensively, although it may not have been on Cypress. I'm pretty sure this can work. 

Have you tried previewing this in lms? It doesn't look like a studio-specific error but it would be good to know. 

Looking at the error, it appears to be an XML parsing issue. Have you tried dropping the `allowfullscreen` attribute that it's complaining about? 





Peter Pinch |  Associate Director of Engineering, Office of Digital Learning
Massachusetts Institute of Technology
One Main Street  |  Cambridge MA 02142
pdp...@mit.edu | T 617-253-6256C 617-652-0183






--
You received this message because you are subscribed to the Google Groups "General Open edX discussion" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/edx-code/69008f0e-85ab-441a-8a9f-234ffb4e277a%40googlegroups.com.
<embedding iframe.png><error.png>

Juan Camilo Montoya Franco

unread,
Feb 11, 2016, 3:07:56 PM2/11/16
to General Open edX discussion
hello Prashant !

you just have to fix the allowfullscreen attribute.

This should work:

<problem>
<p>Which of the following countries has the largest population?</p>
<multiplechoiceresponse>
  <choicegroup label="Which of the following countries has the largest population?" type="MultipleChoice">
    <choice correct="false">Germany</choice>
    <choice correct="true">Indonesia</choice>
    <choice correct="false">Russia</choice>
  </choicegroup>
</multiplechoiceresponse>
<solution>
<div class="detailed-solution">
<p>Explanation</p>
 <iframe width="640" height="360" src="https://www.youtube.com/embed/3_yD_cEKoCk?rel=0&amp;showinfo=0" frameborder="0" allowfullscreen="false"></iframe>
</div>
</solution>
</problem>

best, 

prashant

unread,
Feb 12, 2016, 1:42:43 AM2/12/16
to General Open edX discussion
Hello Peter and Juan,

Thank you very much for your tips. 

Yes, by setting allowfullscreen="false",  error is now gone and video is showing up in explanation. 

Thank you once again. 

-Prashant
Reply all
Reply to author
Forward
0 new messages