Создание наложения видео на карту

Видео взято из исследования Яндекса по каршерингу в Москве
https://yandex.ru/company/researches/2021/drive

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
        <script crossorigin src="https://cdn.jsdelivr.net/npm/@babel/standalone@7/babel.min.js"></script>

        <!-- To make the map appear, you must add your apikey -->
        <script src="https://api-maps.yandex.ru/v3/?apikey=<YOUR_APIKEY>&lang=en_US" type="text/javascript"></script>

        <script
            data-plugins="transform-modules-umd"
            data-presets="react, typescript"
            type="text/babel"
            src="../variables.ts"
        ></script>
        <script
            data-plugins="transform-modules-umd"
            data-presets="typescript"
            type="text/babel"
            src="./common.ts"
        ></script>
        <script data-plugins="transform-modules-umd" data-presets="typescript" type="text/babel">
            import {LOCATION, VIDEO_ATTRIBUTES, VIDEO_BOUNDS, VIDEO_URL, ZOOM_RANGE} from '../variables.js';
            window.map = null;
            
            main();
            async function main() {
                // Waiting for all api elements to be loaded
                await ymaps3.ready;
                const {YMap, YMapDefaultSchemeLayer, YMapDefaultFeaturesLayer} = ymaps3;
            
                const {YMapVideoOverlay} = await ymaps3.import('@yandex/ymaps3-default-ui-theme');
            
                // Initialize the map
                map = new YMap(
                    // Pass the link to the HTMLElement of the container
                    document.getElementById('app'),
                    // Pass the map initialization parameters
                    {location: LOCATION, showScaleInCopyrights: true, zoomRange: ZOOM_RANGE},
                    [
                        // Add a map scheme layer
                        new YMapDefaultSchemeLayer({}),
                        // Add a layer of geo objects to display the polygons
                        new YMapDefaultFeaturesLayer({})
                    ]
                );
            
                // Video overlay example
                const videoOverlay = new YMapVideoOverlay({
                    bounds: VIDEO_BOUNDS,
                    videoUrl: VIDEO_URL,
                    videoAttributes: VIDEO_ATTRIBUTES,
                    className: 'video-overlay'
                });
            
                map.addChild(videoOverlay);
            }
        </script>

        <style> html, body, #app { width: 100%; height: 100%; margin: 0; padding: 0; font-family: Arial, Helvetica, sans-serif; } .toolbar { position: absolute; z-index: 1000; top: 0; left: 0; display: flex; align-items: center; padding: 16px; } .toolbar a { padding: 16px; }  </style>
        <link rel="stylesheet" href="./common.css" />
    </head>
    <body>
        <div id="app"></div>
    </body>
</html>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
        <script crossorigin src="https://cdn.jsdelivr.net/npm/react@17/umd/react.production.min.js"></script>
        <script crossorigin src="https://cdn.jsdelivr.net/npm/react-dom@17/umd/react-dom.production.min.js"></script>
        <script crossorigin src="https://cdn.jsdelivr.net/npm/@babel/standalone@7/babel.min.js"></script>
        <!-- To make the map appear, you must add your apikey -->
        <script src="https://api-maps.yandex.ru/v3/?apikey=<YOUR_APIKEY>&lang=en_US" type="text/javascript"></script>

        <script
            data-plugins="transform-modules-umd"
            data-presets="typescript"
            type="text/babel"
            src="../variables.ts"
        ></script>
        <script
            data-plugins="transform-modules-umd"
            data-presets="typescript"
            type="text/babel"
            src="./common.ts"
        ></script>
        <script data-plugins="transform-modules-umd" data-presets="react, typescript" type="text/babel">
            import {LOCATION, VIDEO_BOUNDS, VIDEO_URL, VIDEO_ATTRIBUTES, ZOOM_RANGE} from '../variables.js';
            
            window.map = null;
            
            main();
            async function main() {
                const [ymaps3React] = await Promise.all([ymaps3.import('@yandex/ymaps3-reactify'), ymaps3.ready]);
                const reactify = ymaps3React.reactify.bindTo(React, ReactDOM);
            
                const {YMap, YMapDefaultSchemeLayer, YMapDefaultFeaturesLayer} = reactify.module(ymaps3);
            
                const {useState} = React;
            
                const {YMapVideoOverlay} = reactify.module(await ymaps3.import('@yandex/ymaps3-default-ui-theme'));
            
                ReactDOM.render(
                    <React.StrictMode>
                        <App />
                    </React.StrictMode>,
                    document.getElementById('app')
                );
            
                function App() {
                    const [location] = useState(LOCATION);
            
                    return (
                        <YMap location={location} showScaleInCopyrights={true} zoomRange={ZOOM_RANGE} ref={(x: any) => (map = x)}>
                            <YMapDefaultSchemeLayer />
                            <YMapDefaultFeaturesLayer />
                            <YMapVideoOverlay
                                className="video-overlay"
                                videoUrl={VIDEO_URL}
                                bounds={VIDEO_BOUNDS}
                                videoAttributes={VIDEO_ATTRIBUTES}
                            />
                        </YMap>
                    );
                }
            }
        </script>

        <style> html, body, #app { width: 100%; height: 100%; margin: 0; padding: 0; font-family: Arial, Helvetica, sans-serif; } .toolbar { position: absolute; z-index: 1000; top: 0; left: 0; display: flex; align-items: center; padding: 16px; } .toolbar a { padding: 16px; }  </style>
        <link rel="stylesheet" href="./common.css" />
    </head>
    <body>
        <div id="app"></div>
    </body>
</html>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
        <script crossorigin src="https://cdn.jsdelivr.net/npm/vue@3/dist/vue.global.js"></script>
        <script crossorigin src="https://cdn.jsdelivr.net/npm/@babel/standalone@7/babel.min.js"></script>

        <script src="https://api-maps.yandex.ru/v3/?apikey=<YOUR_APIKEY>&lang=en_US" type="text/javascript"></script>

        <script
            data-plugins="transform-modules-umd"
            data-presets="react, typescript"
            type="text/babel"
            src="../variables.ts"
        ></script>
        <script
            data-plugins="transform-modules-umd"
            data-presets="typescript"
            type="text/babel"
            src="./common.ts"
        ></script>
        <script data-plugins="transform-modules-umd" data-presets="typescript" type="text/babel">
            import {LOCATION, VIDEO_BOUNDS, VIDEO_URL, VIDEO_ATTRIBUTES, ZOOM_RANGE} from '../variables.js';
            
            window.map = null;
            
            main();
            async function main() {
                const [ymaps3Vue] = await Promise.all([ymaps3.import('@yandex/ymaps3-vuefy'), ymaps3.ready]);
                const vuefy = ymaps3Vue.vuefy.bindTo(Vue);
            
                const {YMap, YMapDefaultSchemeLayer, YMapDefaultFeaturesLayer} = vuefy.module(ymaps3);
            
                const {YMapVideoOverlay} = vuefy.module(await ymaps3.import('@yandex/ymaps3-default-ui-theme'));
            
                const app = Vue.createApp({
                    components: {
                        YMap,
                        YMapDefaultSchemeLayer,
                        YMapDefaultFeaturesLayer,
                        YMapVideoOverlay
                    },
                    setup() {
                        const refMap = (ref: any) => {
                            window.map = ref?.entity;
                        };
            
                        return {LOCATION, refMap, VIDEO_BOUNDS, VIDEO_URL, VIDEO_ATTRIBUTES, ZOOM_RANGE};
                    },
                    template: `
                        <YMap :location="LOCATION" :showScaleInCopyrights="true" :zoomRange="ZOOM_RANGE" :ref="refMap">
                            <YMapDefaultSchemeLayer />
                            <YMapDefaultFeaturesLayer />
            
                            <YMapVideoOverlay
                                :bounds="VIDEO_BOUNDS"
                                :videoUrl="VIDEO_URL"
                                :videoAttributes="VIDEO_ATTRIBUTES"
                                className="video-overlay"
                            />
                        </YMap>`
                });
                app.mount('#app');
            }
        </script>

        <style> html, body, #app { width: 100%; height: 100%; margin: 0; padding: 0; font-family: Arial, Helvetica, sans-serif; } .toolbar { position: absolute; z-index: 1000; top: 0; left: 0; display: flex; align-items: center; padding: 16px; } .toolbar a { padding: 16px; }  </style>
        <link rel="stylesheet" href="./common.css" />
    </head>
    <body>
        <div id="app"></div>
    </body>
</html>
import type {YMapLocationRequest, LngLatBounds, VideoAttributes, ZoomRange} from '@yandex/ymaps3-types';

export const LOCATION: YMapLocationRequest = {
    center: [37.6215, 55.7355], // starting position [lng, lat]
    zoom: 9 // starting zoom
};

export const ZOOM_RANGE: ZoomRange = {
    min: 8,
    max: 11
};

export const VIDEO_BOUNDS: LngLatBounds = [
    [37.293, 55.555],
    [37.95, 55.92]
];

export const VIDEO_ATTRIBUTES: VideoAttributes = {
    autoplay: true,
    loop: true,
    muted: true,
    controls: false,
    playsInline: true
};
// Example video URL (you can replace with your own video file or URL)
export const VIDEO_URL: string = 'https://yastatic.net/s3/milab/2020/drive/heatmap-video/assets/2x.mp4';
ymaps3.import.registerCdn('https://cdn.jsdelivr.net/npm/{package}', ['@yandex/ymaps3-default-ui-theme@0.0']);
.video-overlay {
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    opacity: 0.8;
    filter: brightness(1.1) contrast(1.05);
}