Layers (32)
Display buildings in 3DExtrude polygons for 3D indoor mappingAdd a 3D modelAdjust a layer's opacityAnimate a lineAnimate a series of imagesAnimate a pointChange building color based on zoom levelChange the case of labelsDisplay HTML clusters with custom propertiesCreate and style clustersChange a layer's color with buttonsAdd a custom style layerStyle circles with a data-driven propertyStyle lines with a data-driven propertyDisplay and style rich text labelsUse a fallback imageAdd a pattern to a polygonAdd a new layer below labelsAdd a GeoJSON lineDraw GeoJSON pointsAdd hillshadingCreate a heatmap layerCreate a gradient line using an expressionAdd multiple geometries from one GeoJSON sourceStyle ocean depth dataShow and hide layersUpdate a choropleth layer by zoom levelChange worldview of administrative boundariesVariable label placementVisualize population densityAdd a GeoJSON polygon

Add a video

Satellite raster baselayer with video on top. Click on the map to play and pause.

<!DOCTYPE html>
<meta charset="utf-8" />
<title>Add a video</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<script src="https://api.mapbox.com/mapbox-gl-js/v1.6.1/mapbox-gl.js"></script>
<link href="https://api.mapbox.com/mapbox-gl-js/v1.6.1/mapbox-gl.css" rel="stylesheet" />
body { margin: 0; padding: 0; }
#map { position: absolute; top: 0; bottom: 0; width: 100%; };
<div id="map"></div>
mapboxgl.accessToken = '<your access token here>';
var videoStyle = {
'version': 8,
'sources': {
'satellite': {
'type': 'raster',
'url': 'mapbox://mapbox.satellite',
'tileSize': 256
'video': {
'type': 'video',
'urls': [
'coordinates': [
[-122.51596391201019, 37.56238816766053],
[-122.51467645168304, 37.56410183312965],
[-122.51309394836426, 37.563391708549425],
[-122.51423120498657, 37.56161849366671]
'layers': [
'id': 'background',
'type': 'background',
'paint': {
'background-color': 'rgb(4,7,14)'
'id': 'satellite',
'type': 'raster',
'source': 'satellite'
'id': 'video',
'type': 'raster',
'source': 'video'
var map = new mapboxgl.Map({
container: 'map',
minZoom: 14,
zoom: 17,
center: [-122.514426, 37.562984],
bearing: -96,
style: videoStyle
var playingVideo = true;
map.on('click', function() {
playingVideo = !playingVideo;
if (playingVideo) map.getSource('video').play();
else map.getSource('video').pause();
Was this example helpful?