Moodle

When inserting a MP3 file, the object tag used in the <noscript> is not allowed in that context within the XHTML 1.0 Strict

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.9.3
  • Fix Version/s: 1.9.5
  • Component/s: Accessibility, Resource
  • Labels:
    None

Description

When embedding a MP3 file as a resource, it will create the next code:

<noscript>
<object type="audio/mpeg" data="http://127.0.0.1/moodle/file.php/3/Media_examples/world-tour.mp3" width="600" height="70"><param name="src" value="http://127.0.0.1/moodle/file.php/3/Media_examples/world-tour.mp3" /><param name="quality" value="high" /><param name="autoplay" value="true" /><param name="autostart" value="true" /></object>
<p><a href="http://127.0.0.1/moodle/file.php/3/Media_examples/world-tour.mp3">http://127.0.0.1/moodle/file.php/3/Media_examples/world-tour.mp3</a></p>
</noscript>

The <object> tag used can only be inside another tag such as: <div>, <p>, <h1>, ...

This can be seen in: http://demo.moodle.org/mod/resource/view.php?id=234

The easiest way to solve it is to embed the object tag in a <div> tag, such as:
<noscript>
<div>
<object type="audio/mpeg" data="http://127.0.0.1/moodle/file.php/3/Media_examples/world-tour.mp3" width="600" height="70"><param name="src" value="http://127.0.0.1/moodle/file.php/3/Media_examples/world-tour.mp3" /><param name="quality" value="high" /><param name="autoplay" value="true" /><param name="autostart" value="true" /></object>
</div>
<p><a href="http://127.0.0.1/moodle/file.php/3/Media_examples/world-tour.mp3">http://127.0.0.1/moodle/file.php/3/Media_examples/world-tour.mp3</a></p>
</noscript>

Issue Links

Activity

Hide
Eloy Lafuente (stronk7) added a comment -

Addressing for 1.9.4 and assigning to Dongsheg too (it's the multimedia filter if I'm not wrong, Dong). Not sure.

Show
Eloy Lafuente (stronk7) added a comment - Addressing for 1.9.4 and assigning to Dongsheg too (it's the multimedia filter if I'm not wrong, Dong). Not sure.
Hide
Dongsheng Cai added a comment -

Fixed, please review, thanks

Show
Dongsheng Cai added a comment - Fixed, please review, thanks
Hide
David Horat added a comment -

It would be better not to use inline styles, but rather a CSS selector instead of
<div id="'.$div_id.'" style="display:inline"></div>

If there is none that you could reuse in the default CSS theme, you could add a new one for objects.

Show
David Horat added a comment - It would be better not to use inline styles, but rather a CSS selector instead of <div id="'.$div_id.'" style="display:inline"></div> If there is none that you could reuse in the default CSS theme, you could add a new one for objects.
Hide
Dongsheng Cai added a comment -

Fixed again, thanks david.

Show
Dongsheng Cai added a comment - Fixed again, thanks david.
Hide
David Horat added a comment -

Your welcome.

Show
David Horat added a comment - Your welcome.
Hide
Vlas Voloshin added a comment -

Due to the changes made by patches 1.38.2.7 and 1.38.2.8 the text about flash player not installed on client's computer inside <span> is always displayed (the span has other id, so the text is not replaced by javascript). This caused regression to all pages, where swf, mp3 or flv files are inserted via media_plugin filter, not via resource. As I understand, when swf or mp3 resources are inserted into course, the media_plugin filter is not used. When the object is inserted via media_plugin, it is always inside <span>, is it allowed by XHTML strict? If it is, another <div> is not necessary.
I propose to revert these patches and revise the problem of XHTML strict code in media objects.

Show
Vlas Voloshin added a comment - Due to the changes made by patches 1.38.2.7 and 1.38.2.8 the text about flash player not installed on client's computer inside <span> is always displayed (the span has other id, so the text is not replaced by javascript). This caused regression to all pages, where swf, mp3 or flv files are inserted via media_plugin filter, not via resource. As I understand, when swf or mp3 resources are inserted into course, the media_plugin filter is not used. When the object is inserted via media_plugin, it is always inside <span>, is it allowed by XHTML strict? If it is, another <div> is not necessary. I propose to revert these patches and revise the problem of XHTML strict code in media objects.
Hide
Joseph Rézeau added a comment -

The recent changes in the display of an embedded MP3 player ruin my Moodle course displays!

I need to embed MP3 players within paragraphs. But because of the extra <div> tag which has been added (further to David's suggestion), it is now impossible for me to do so. On top of it I get a validtion error because of course <div> tags are not allowed inside <p></p> paragraphs.

I suggest replacing that <div> tag with a <span> tag. I have tried it and it works and there is no validation problem.

Attached screenshots_JR show what is displayed with current <div> MP3 div tag (#1) vs the display using my suggested replacement with a <span> tag (#2). Unless there are adverse effects I strongly insist that my suggestion be applied as soon as possible, to restore my current moodle course functionality.

Thanks,
Joseph

Show
Joseph Rézeau added a comment - The recent changes in the display of an embedded MP3 player ruin my Moodle course displays! I need to embed MP3 players within paragraphs. But because of the extra <div> tag which has been added (further to David's suggestion), it is now impossible for me to do so. On top of it I get a validtion error because of course <div> tags are not allowed inside <p></p> paragraphs. I suggest replacing that <div> tag with a <span> tag. I have tried it and it works and there is no validation problem. Attached screenshots_JR show what is displayed with current <div> MP3 div tag (#1) vs the display using my suggested replacement with a <span> tag (#2). Unless there are adverse effects I strongly insist that my suggestion be applied as soon as possible, to restore my current moodle course functionality. Thanks, Joseph
Hide
Joseph Rézeau added a comment -

This needs to be re-opened, see my previous comment and screenshots.
Joseph

Show
Joseph Rézeau added a comment - This needs to be re-opened, see my previous comment and screenshots. Joseph
Hide
David Horat added a comment -

Unfortunately the <span> tag instead of the <div> doesn´t work when the MP3 is included as a resource because the <object> tag must be included into a block tag (div, p, etc.).

In your case it worked because when you embed it in the middle of a text, there is no <noscript> tag around the object and the text is usually surrounded by either <p> or <div>.

Thus, we have a problem here.

One possible solution is to use the <span> tag for the filter and when using it as a resource add a <div> tag. We can also make all resources be around a <div> tag. Maybe someone else knows which is the best solution or if there is a better one.

Regards,
David

Show
David Horat added a comment - Unfortunately the <span> tag instead of the <div> doesn´t work when the MP3 is included as a resource because the <object> tag must be included into a block tag (div, p, etc.). In your case it worked because when you embed it in the middle of a text, there is no <noscript> tag around the object and the text is usually surrounded by either <p> or <div>. Thus, we have a problem here. One possible solution is to use the <span> tag for the filter and when using it as a resource add a <div> tag. We can also make all resources be around a <div> tag. Maybe someone else knows which is the best solution or if there is a better one. Regards, David
Hide
Joseph Rézeau added a comment -

David, what exactly do you mean by "when the MP3 is included as a resource" ?
Do you mean: Add a resource / Link to a file or website / Choose or upload a file / Select an MP3 file from the course Files ?
This results in the "huge" mp3 player to be displayed all alone on one page (which does not validate, by the way).
I don't think many people use that way of displaying MP3 files.
Or what else do you mean?
Joseph

Show
Joseph Rézeau added a comment - David, what exactly do you mean by "when the MP3 is included as a resource" ? Do you mean: Add a resource / Link to a file or website / Choose or upload a file / Select an MP3 file from the course Files ? This results in the "huge" mp3 player to be displayed all alone on one page (which does not validate, by the way). I don't think many people use that way of displaying MP3 files. Or what else do you mean? Joseph
Hide
David Horat added a comment - - edited

Yes, I meant exactly that.

The "huge player" depends on what you use to render audio/mpeg mime type in your browser. But it is usually that way.

Version 1.9.3 + the div tag validated. I haven´t tested 1.9.4.

Anyway, I agree with you that the current fix can break some exercises as yours, so some of the solutions I proposed or others should be done.

Show
David Horat added a comment - - edited Yes, I meant exactly that. The "huge player" depends on what you use to render audio/mpeg mime type in your browser. But it is usually that way. Version 1.9.3 + the div tag validated. I haven´t tested 1.9.4. Anyway, I agree with you that the current fix can break some exercises as yours, so some of the solutions I proposed or others should be done.
Hide
Dongsheng Cai added a comment -

I have to revert this patch to make filter working with in p tag, it is impossible to use p or div tags within p, so we cannot use div here, any good suggestion is welcomed.

TIA.

Show
Dongsheng Cai added a comment - I have to revert this patch to make filter working with in p tag, it is impossible to use p or div tags within p, so we cannot use div here, any good suggestion is welcomed. TIA.
Hide
Artem Andreev added a comment -

I don't understand why filter/mediaplugin/filter.php has been modified? Problem occurs with RESOURCE "mp3-file"? AFAIK resources have own implemetation of inserting media-objects. See mod/resource/type/file/resource.class.php:~520

Show
Artem Andreev added a comment - I don't understand why filter/mediaplugin/filter.php has been modified? Problem occurs with RESOURCE "mp3-file"? AFAIK resources have own implemetation of inserting media-objects. See mod/resource/type/file/resource.class.php:~520
Hide
Dongsheng Cai added a comment -

Shouldn't use div tag inside p tag

Show
Dongsheng Cai added a comment - Shouldn't use div tag inside p tag
Hide
Eloy Lafuente (stronk7) added a comment -

Uhm... reviewing this... which is current status? It seems that the original bug talks about resources adding mp3, and not about contents handled by multimedia filter (my fault, because I did that assumption in my first reply here).

So... David, Dongsheng... is it ok to have this resolved or do we need to modify anything in resource code? Also, the multimedia filter has been reverted to original status, correct?

Reopening until reply arrives... ciao

Show
Eloy Lafuente (stronk7) added a comment - Uhm... reviewing this... which is current status? It seems that the original bug talks about resources adding mp3, and not about contents handled by multimedia filter (my fault, because I did that assumption in my first reply here). So... David, Dongsheng... is it ok to have this resolved or do we need to modify anything in resource code? Also, the multimedia filter has been reverted to original status, correct? Reopening until reply arrives... ciao
Hide
David Horat added a comment -

Well, it seems that the problems is still there so it still needs to be fixed. I haven´t tested it in 1.9.4 since I am currently not developing in Moodle.

Show
David Horat added a comment - Well, it seems that the problems is still there so it still needs to be fixed. I haven´t tested it in 1.9.4 since I am currently not developing in Moodle.
Hide
Dongsheng Cai added a comment -

Hi, David, seems we cannot use div inside p tags, so we shouldn't use div here.

Show
Dongsheng Cai added a comment - Hi, David, seems we cannot use div inside p tags, so we shouldn't use div here.
Hide
Dongsheng Cai added a comment - - edited

David, I have reverted the old version since we should NOT use div inside p tags, do you agree, if so this bug will be resolved as "won't fix"

Show
Dongsheng Cai added a comment - - edited David, I have reverted the old version since we should NOT use div inside p tags, do you agree, if so this bug will be resolved as "won't fix"
Hide
Joseph Rézeau added a comment -

Dongsheng Cai " have reverted the old version since we should use div inside p tags..."

Dongsheng, I suppose you mean "since we should NOT use div inside p tags" ?
Joseph

Show
Joseph Rézeau added a comment - Dongsheng Cai " have reverted the old version since we should use div inside p tags..." Dongsheng, I suppose you mean "since we should NOT use div inside p tags" ? Joseph
Hide
Dongsheng Cai added a comment -

Yes, sorry for typo

Show
Dongsheng Cai added a comment - Yes, sorry for typo
Hide
David Horat added a comment -

Right now I don't have time to fix it since I just changed job and residence. Anyway, it should be fixed in the future because Accesibility Laws in both US and EU are very clear in these kind of things.

Show
David Horat added a comment - Right now I don't have time to fix it since I just changed job and residence. Anyway, it should be fixed in the future because Accesibility Laws in both US and EU are very clear in these kind of things.
Hide
Dongsheng Cai added a comment -

close it, waiting for a better solution, feel free to reopen it if you have better idea

Show
Dongsheng Cai added a comment - close it, waiting for a better solution, feel free to reopen it if you have better idea

People

Dates

  • Created:
    Updated:
    Resolved: