drop flash support
This commit is contained in:
parent
3e60774e4b
commit
6221fbb096
3 changed files with 266 additions and 357 deletions
|
@ -48,13 +48,12 @@
|
||||||
|
|
||||||
"bower-asset/jquery" : "^1.12",
|
"bower-asset/jquery" : "^1.12",
|
||||||
"bower-asset/jquery-timeago" : "^1.5",
|
"bower-asset/jquery-timeago" : "^1.5",
|
||||||
"bower-asset/mediaelement" : "^2.21",
|
|
||||||
"bower-asset/js-cookie" : "^2.1"
|
"bower-asset/js-cookie" : "^2.1"
|
||||||
},
|
},
|
||||||
|
|
||||||
"require-dev" : {
|
"require-dev" : {
|
||||||
"phpunit/phpunit" : "^9.0",
|
"phpunit/phpunit" : "^9.0",
|
||||||
"friendsofphp/php-cs-fixer" : "*"
|
"friendsofphp/php-cs-fixer" : "*"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"ext-memcache": "memcache caching",
|
"ext-memcache": "memcache caching",
|
||||||
|
|
573
composer.lock
generated
573
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -8,11 +8,9 @@ class VideoFileHandlerTheme extends Themelet
|
||||||
$ilink = $image->get_image_link();
|
$ilink = $image->get_image_link();
|
||||||
$thumb_url = make_http($image->get_thumb_link()); //used as fallback image
|
$thumb_url = make_http($image->get_thumb_link()); //used as fallback image
|
||||||
$mime = strtolower($image->get_mime());
|
$mime = strtolower($image->get_mime());
|
||||||
$full_url = make_http($ilink);
|
|
||||||
$autoplay = $config->get_bool(VideoFileHandlerConfig::PLAYBACK_AUTOPLAY);
|
$autoplay = $config->get_bool(VideoFileHandlerConfig::PLAYBACK_AUTOPLAY);
|
||||||
$loop = $config->get_bool(VideoFileHandlerConfig::PLAYBACK_LOOP);
|
$loop = $config->get_bool(VideoFileHandlerConfig::PLAYBACK_LOOP);
|
||||||
$mute = $config->get_bool(VideoFileHandlerConfig::PLAYBACK_MUTE);
|
$mute = $config->get_bool(VideoFileHandlerConfig::PLAYBACK_MUTE);
|
||||||
$player = make_link('vendor/bower-asset/mediaelement/build/flashmediaelement.swf');
|
|
||||||
|
|
||||||
$width="auto";
|
$width="auto";
|
||||||
if ($image->width>1) {
|
if ($image->width>1) {
|
||||||
|
@ -28,47 +26,22 @@ class VideoFileHandlerTheme extends Themelet
|
||||||
//Browser media format support: https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats
|
//Browser media format support: https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats
|
||||||
|
|
||||||
if (MimeType::matches_array($mime, VideoFileHandler::SUPPORTED_MIME)) {
|
if (MimeType::matches_array($mime, VideoFileHandler::SUPPORTED_MIME)) {
|
||||||
//FLV isn't supported by <video>, but it should always fallback to the flash-based method.
|
|
||||||
if ($mime == MimeType::WEBM) {
|
if ($mime == MimeType::WEBM) {
|
||||||
//Several browsers still lack WebM support sadly: https://caniuse.com/#feat=webm
|
//Several browsers still lack WebM support sadly: https://caniuse.com/#feat=webm
|
||||||
$html .= "<!--[if IE]><p>To view webm files with IE, please <a href='https://tools.google.com/dlpage/webmmf/' target='_blank'>download this plugin</a>.</p><![endif]-->";
|
$html .= "<!--[if IE]><p>To view webm files with IE, please <a href='https://tools.google.com/dlpage/webmmf/' target='_blank'>download this plugin</a>.</p><![endif]-->";
|
||||||
}
|
}
|
||||||
|
|
||||||
$html_fallback = "
|
$autoplay = ($autoplay ? ' autoplay' : '');
|
||||||
<object width=\"100%\" height=\"480px\" type=\"application/x-shockwave-flash\" data=\"$player\">
|
$loop = ($loop ? ' loop' : '');
|
||||||
<param name=\"movie\" value=\"$player\" />
|
$mute = ($mute ? ' muted' : '');
|
||||||
|
|
||||||
<param name=\"allowFullScreen\" value=\"true\" />
|
$html .= "
|
||||||
<param name=\"wmode\" value=\"opaque\" />
|
<video controls class='shm-main-image' id='main_image' alt='main image' poster='$thumb_url' {$autoplay} {$loop} {$mute}
|
||||||
|
style='height: $height; width: $width; max-width: 100%; object-fit: contain; background-color: black;'>
|
||||||
<param name=\"flashVars\" value=\""
|
<source src='{$ilink}' type='{$mime}'>
|
||||||
. "controls=true"
|
</video>
|
||||||
. "&autoplay=" . ($autoplay ? 'true' : 'false')
|
<script>$('#main_image').prop('volume', 0.25);</script>
|
||||||
. "&poster={$thumb_url}"
|
";
|
||||||
. "&file={$full_url}"
|
|
||||||
. "&loop=" . ($loop ? 'true' : 'false') . "\" />
|
|
||||||
<img alt='thumb' src=\"{$thumb_url}\" />
|
|
||||||
</object>";
|
|
||||||
|
|
||||||
if ($mime == MimeType::FLASH_VIDEO) {
|
|
||||||
//FLV doesn't support <video>.
|
|
||||||
$html .= $html_fallback;
|
|
||||||
} else {
|
|
||||||
$autoplay = ($autoplay ? ' autoplay' : '');
|
|
||||||
$loop = ($loop ? ' loop' : '');
|
|
||||||
$mute = ($mute ? ' muted' : '');
|
|
||||||
|
|
||||||
$html .= "
|
|
||||||
<video controls class='shm-main-image' id='main_image' alt='main image' poster='$thumb_url' {$autoplay} {$loop} {$mute}
|
|
||||||
style='height: $height; width: $width; max-width: 100%; object-fit: contain; background-color: black;'>
|
|
||||||
<source src='{$ilink}' type='{$mime}'>
|
|
||||||
|
|
||||||
<!-- If browser doesn't support filetype, fallback to flash -->
|
|
||||||
{$html_fallback}
|
|
||||||
</video>
|
|
||||||
<script>$('#main_image').prop('volume', 0.25);</script>
|
|
||||||
";
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
//This should never happen, but just in case let's have a fallback..
|
//This should never happen, but just in case let's have a fallback..
|
||||||
$html = "Video type '$mime' not recognised";
|
$html = "Video type '$mime' not recognised";
|
||||||
|
|
Reference in a new issue