Skip to content

Commit

Permalink
MDL-76104 mediaplayer_youtube: Respect container max width
Browse files Browse the repository at this point in the history
  • Loading branch information
HuongNV13 committed Jun 26, 2023
1 parent 660d714 commit 83579a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion filter/mediaplugin/tests/filter_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ function test_filter_mediaplugin_link() {
$paddedurl = str_pad($originalurl, 6000, 'z');
$validpaddedurl = '<p>Some text.</p><pre style="color: rgb(0, 0, 0); line-height: normal;"><span class="mediaplugin mediaplugin_youtube">
<iframe title="Valid link" width="640" height="360"
src="https://www.youtube.com/embed/uUhWl9Lm3OM?rel=0&amp;wmode=transparent" frameborder="0" allowfullscreen="1"></iframe>
src="https://www.youtube.com/embed/uUhWl9Lm3OM?rel=0&amp;wmode=transparent" frameborder="0"
allowfullscreen="1" style="max-width: 100%;"></iframe>
</span></pre><pre style="color: rgb(0, 0, 0); line-height: normal;">';
$validpaddedurl = str_pad($validpaddedurl, 6000 + (strlen($validpaddedurl) - strlen($originalurl)), 'z');

Expand Down
6 changes: 4 additions & 2 deletions media/player/youtube/classes/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ protected function embed_external(moodle_url $url, $name, $width, $height, $opti

return <<<OET
<span class="mediaplugin mediaplugin_youtube">
<iframe width="$width" height="$height" src="https://$site/embed/videoseries?list=$playlist" frameborder="0" allowfullscreen="1"></iframe>
<iframe width="$width" height="$height" src="https://$site/embed/videoseries?list=$playlist" frameborder="0"
allowfullscreen="1" style="max-width: 100%;"></iframe>
</span>
OET;
} else {
Expand All @@ -100,7 +101,8 @@ protected function embed_external(moodle_url $url, $name, $width, $height, $opti
return <<<OET
<span class="mediaplugin mediaplugin_youtube">
<iframe title="$info" width="$width" height="$height"
src="https://www.youtube.com/embed/$videoid?{$params}rel=0&amp;wmode=transparent" frameborder="0" allowfullscreen="1"></iframe>
src="https://www.youtube.com/embed/$videoid?{$params}rel=0&amp;wmode=transparent" frameborder="0"
allowfullscreen="1" style="max-width: 100%;"></iframe>
</span>
OET;
}
Expand Down

0 comments on commit 83579a0

Please sign in to comment.