add video preview
This commit is contained in:
parent
11742e39da
commit
dd5f653fcf
|
@ -73,6 +73,7 @@ class PanoramaViewer extends AbstractBlockLayout
|
|||
|
||||
$urls = [];
|
||||
$media_types = [];
|
||||
$thumbnails = [];
|
||||
$panorama_type = $block->dataValue('panorama_type');
|
||||
static $id = 0;
|
||||
|
||||
|
@ -88,6 +89,7 @@ class PanoramaViewer extends AbstractBlockLayout
|
|||
} elseif (strpos($mediaType, 'image/') !== false){
|
||||
array_push($urls, $media->originalUrl());
|
||||
}
|
||||
array_push($thumbnails, $media->thumbnailUrls());
|
||||
}
|
||||
}
|
||||
$width = $block->dataValue('width');
|
||||
|
@ -101,6 +103,7 @@ class PanoramaViewer extends AbstractBlockLayout
|
|||
'urls' => $urls,
|
||||
'id' => 'pv-' . ++$id,
|
||||
'mediaTypes' => $media_types,
|
||||
'thumbnails' => $thumbnails,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div style="position:relative;">
|
||||
<div class="pannemmul-wrap" style="position:relative;">
|
||||
|
||||
<?php
|
||||
$this->headLink()->appendStylesheet($this->assetUrl('vendor/pannellum/pannellum.css',
|
||||
|
@ -28,13 +28,12 @@
|
|||
}
|
||||
</style>
|
||||
|
||||
<div class="pannellum-wrap">
|
||||
<?php if ($panorama_type == "video") { ?>
|
||||
|
||||
<video id="<?= $id ?>"
|
||||
class="video-js vjs-default-skin vjs-big-play-centered"
|
||||
controls preload="none"
|
||||
style="width:<?= $width ?>px; height: <?= $height ?>px;"
|
||||
poster="/images/video/jfk-poster.jpg"
|
||||
poster="<?= $thumbnails[0]['medium'] ?>"
|
||||
crossorigin="anonymous">
|
||||
<?php for($i = 0; $i < count($urls); ++$i) { ?>
|
||||
<source src="<?= $urls[$i] ?>" type="<?= $mediaTypes[$i] ?>"/>
|
||||
|
@ -45,14 +44,10 @@
|
|||
target="_blank">supports HTML5 video</a>
|
||||
</p>
|
||||
</video>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<div class="pannellum">
|
||||
<div id="<?= $id ?>" class="panorama-viewer"></div>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue