Skip to content

Commit

Permalink
Merge pull request #28 from hyvor/youtube-shorts-margin-auti
Browse files Browse the repository at this point in the history
youtube shorts margin auto
  • Loading branch information
supun-io authored Oct 29, 2024
2 parents 8ded578 + b8a32c7 commit b0fe84a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Embed/Platforms/Youtube.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function getEmbedHtml($matches): string

if ($isShort) {
// set max width same as the youtube player
$html = '<div style="width:calc(56.25vh - 54px);min-width:315px;max-width:100%">' . $html . '</div>';
$html = '<div style="width:calc(56.25vh - 54px);min-width:315px;max-width:100%;margin:auto;">' . $html . '</div>';
}

return $html;
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Embed/Platforms/YoutubeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
$response = $parser->parse($match);

expect($response)->toBe(
'<div style="width:calc(56.25vh - 54px);min-width:315px;max-width:100%"><div style="position:relative;left:0;width:100%;height:0;padding-bottom:177.78%;"><iframe src="https://www.youtube.com/embed/uehCDW1fxUw" style="position: absolute;top:0;left:0;width:100%;height:100%;border:0;" allow="fullscreen;accelerometer;clipboard-write;encrypted-media;gyroscope;picture-in-picture;web-share;"></iframe></div></div>'
'<div style="width:calc(56.25vh - 54px);min-width:315px;max-width:100%;margin:auto;"><div style="position:relative;left:0;width:100%;height:0;padding-bottom:177.78%;"><iframe src="https://www.youtube.com/embed/uehCDW1fxUw" style="position: absolute;top:0;left:0;width:100%;height:100%;border:0;" allow="fullscreen;accelerometer;clipboard-write;encrypted-media;gyroscope;picture-in-picture;web-share;"></iframe></div></div>'
);
});

Expand Down

0 comments on commit b0fe84a

Please sign in to comment.