PSV Equirectangular Video Demo
by mistic100
HTML
<script src="https://cdn.jsdelivr.net/npm/uevent@2/browser.js"></script>
<script src="https://cdn.jsdelivr.net/npm/three/build/three.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photo-sphere-viewer@4/dist/photo-sphere-viewer.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photo-sphere-viewer@4/dist/photo-sphere-viewer.css">
<script src="https://cdn.jsdelivr.net/npm/photo-sphere-viewer@4/dist/adapters/equirectangular-video.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photo-sphere-viewer@4/dist/plugins/video.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photo-sphere-viewer@4/dist/plugins/video.css">
<script src="https://cdn.jsdelivr.net/npm/photo-sphere-viewer@4/dist/plugins/settings.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photo-sphere-viewer@4/dist/plugins/settings.css">
<script src="https://cdn.jsdelivr.net/npm/photo-sphere-viewer@4/dist/plugins/resolution.js"></script>
<div id="photosphere"></div>
CSS
html, body, #photosphere {
margin: 0;
width: 100%;
height: 100%;
}
JavaScript
const base = 'https://photo-sphere-viewer-data.netlify.app/assets/equirectangular-video/';
new PhotoSphereViewer.Viewer({
container: 'photosphere',
adapter : [PhotoSphereViewer.EquirectangularVideoAdapter, {
muted : true,
}],
panorama : { source: base + 'Ayutthaya_HD.mp4' },
caption : 'Ayutthaya <b>© meetle</b>',
loadingImg: 'https://photo-sphere-viewer.js.org/assets/photosphere-logo.gif',
touchmoveTwoFingers: true,
mousewheelCtrlKey: true,
navbar: 'video autorotate caption settings fullscreen',
plugins : [
[PhotoSphereViewer.VideoPlugin, {
keypoints : [
{ time: 0, position: { longitude: 0, latitude: 0 } },
{ time: 5, position: { longitude: -Math.PI / 4, latitude: Math.PI / 8 } },
{ time: 10, position: { longitude: -Math.PI / 2, latitude: 0 } },
{ time: 15, position: { longitude: -3 * Math.PI / 4, latitude: -Math.PI / 8 } },
{ time: 20, position: { longitude: -Math.PI, latitude: 0 } },
{ time: 25, position: { longitude: -5 * Math.PI / 4, latitude: Math.PI / 8 } },
{ time: 30, position: { longitude: -3 * Math.PI / 2, latitude: 0 } },
{ time: 35, position: { longitude: -7 * Math.PI / 4, latitude: -Math.PI / 8 } },
]
}],
PhotoSphereViewer.SettingsPlugin,
[PhotoSphereViewer.ResolutionPlugin, {
resolutions: [
{
id : 'UHD',
label : 'Ultra high',
panorama: { source: base + 'Ayutthaya_UHD.mp4' },
},
{
id : 'FHD',
label : 'High',
panorama: { source: base + 'Ayutthaya_FHD.mp4' },
},
{
id : 'HD',
label : 'Standard',
panorama: { source: base + 'Ayutthaya_HD.mp4' },
},
{
id : 'SD',
label : 'Low',
panorama: { source: base + 'Ayutthaya_SD.mp4' },
},
]
}]
],
});