mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-12-08 21:26:14 +00:00
Now that tile.openstreetmap.org supports HTTP/2 + HTTP/3 the old (a|b|c).tile.openstreetmap.org is no longer recommended. Use tile.openstreetmap.org directly is faster and will likely result in a better cache hit ratio. Signed-off-by: Grant Slater <git@firefishy.com> Signed-off-by: Grant Slater <git@firefishy.com>
79 lines
1.9 KiB
HTML
79 lines
1.9 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Leaflet debug page</title>
|
|
<meta charset="utf-8" />
|
|
|
|
<link rel="stylesheet" href="../../dist/leaflet.css" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<link rel="stylesheet" href="../css/screen.css" />
|
|
|
|
<script src="../../dist/leaflet-src.js"></script>
|
|
</head>
|
|
<body>
|
|
|
|
<div id="map" style='width:750px; height: 450px;'></div>
|
|
<button id="populate">Populate with 10 markers</button>
|
|
|
|
<script type="text/javascript">
|
|
|
|
var map = L.map('map');
|
|
|
|
var osm = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
|
maxZoom: 19,
|
|
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
|
}).addTo(map);
|
|
|
|
var videoUrls = [
|
|
'https://www.mapbox.com/bites/00188/patricia_nasa.webm',
|
|
'https://www.mapbox.com/bites/00188/patricia_nasa.mp4'
|
|
],
|
|
bounds = L.latLngBounds([[ 32, -130], [ 13, -100]]);
|
|
|
|
map.fitBounds(bounds);
|
|
|
|
var overlay = L.videoOverlay(videoUrls, bounds, {
|
|
opacity: 0.8,
|
|
interactive: true,
|
|
autoplay: true,
|
|
loop: true,
|
|
muted: true,
|
|
playsInline: true
|
|
});
|
|
map.addLayer(overlay);
|
|
|
|
overlay.on('dblclick',function (e) {
|
|
console.log('Double click on image.');
|
|
});
|
|
|
|
overlay.on('load', function () {
|
|
var MyPauseControl = L.Control.extend({
|
|
onAdd: function() {
|
|
var button = L.DomUtil.create('button');
|
|
button.innerHTML = '⏸';
|
|
L.DomEvent.on(button, 'click', function () {
|
|
overlay.getElement().pause();
|
|
});
|
|
return button;
|
|
}
|
|
});
|
|
var MyPlayControl = L.Control.extend({
|
|
onAdd: function() {
|
|
var button = L.DomUtil.create('button');
|
|
button.innerHTML = '⏵';
|
|
L.DomEvent.on(button, 'click', function () {
|
|
overlay.getElement().play();
|
|
});
|
|
return button;
|
|
}
|
|
});
|
|
|
|
var pauseControl = (new MyPauseControl()).addTo(map);
|
|
var playControl = (new MyPlayControl()).addTo(map);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|