/
githubmirror
/
Leaflet
Обзор
Документация
Войти
/
githubmirror
/
Leaflet
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
debug/map/video-overlay.html
73 строки
2 KB
Jon Koops
Remove `Class.extend()` entirely (#10006)
09 дек 2025, 14:59
Не верифицирован
09 дек 2025, 14:59
baed386
Код
Авторство
О чём код?
<!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Leaflet debug page - Video Overlay</title> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0" /> <link rel="stylesheet" href="../../dist/leaflet.css" /> <link rel="stylesheet" href="../css/screen.css" /> <script type="importmap"> { "imports": { "leaflet": "../../dist/leaflet-src.js" } } </script> </head> <body> <div id="map"></div> <script type="module"> import {LeafletMap, TileLayer, LatLngBounds, VideoOverlay, Control, DomEvent, DomUtil} from 'leaflet'; const map = new LeafletMap('map'); new TileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {maxZoom: 19}).addTo(map); const bounds = new LatLngBounds([[32, -130], [13, -100]]); map.fitBounds(bounds); const overlay = new VideoOverlay([ 'https://www.mapbox.com/bites/00188/patricia_nasa.webm', 'https://www.mapbox.com/bites/00188/patricia_nasa.mp4' ], bounds, { opacity: 0.8, interactive: true, autoplay: true, controls: true, loop: true, muted: true, playsInline: true }); map.addLayer(overlay); overlay.on('dblclick', () => console.log('Double click on image.')); overlay.on('load', () => { class MyPauseControl extends Control { onAdd() { const button = DomUtil.create('button'); button.textContent = '⏸'; DomEvent.on(button, 'click', () => { overlay.getElement().pause(); }); return button; } } class MyPlayControl extends Control { onAdd() { const button = DomUtil.create('button'); button.textContent = '⏵'; DomEvent.on(button, 'click', () => { overlay.getElement().play(); }); return button; } } new MyPauseControl().addTo(map); new MyPlayControl().addTo(map); }); </script> </body> </html>