BWeb adlı üyeden alıntı: mesajı görüntüle
Hocam birde doğrudan playera custom header ekleyip o headerı video sunucusunda kontrol ettirerek engelleme yapılabiliyormuş idm ve türevleri sadece referrer kullandığı için custom headeri geçemeyip 403 e düşüyormuş bunun hakkında bilginiz var mı?
https://api.video/blog/tutorials/ins...custom-headers
Bundan bahsediyorsunuz galiba hocam. Xhr içine session token ekliyor ancak video indirme eklentileri bildiğim kadarıyla mp4 src lerini tarıyor. Videoyu api ile de alsanız kaynakta gözükecektir.
https://stackoverflow.com/a/49955548/17711355
Bir post metodu oluşturup token vb ile video url adresini aldıktan sonra linkteki yöntem ile yeni bir url oluşturup js ile canvasa basabilirsiniz. Size örnek bir kodu aşağıda yazdım.
<!DOCTYPE html>
<html lang="tr">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        canvas {
            max-width: 100%;
            max-height: 100%;
        }
    </style>
</head>

<body>
    <button class="zfc">Play / Pause</button>
    <div class="canvas-video-zfc">
        <canvas id="canvas"></canvas>
    </div>


    <script>



        const startPlayer = (z) => {


            var canvas = document.getElementById('canvas');
            var ctx = canvas.getContext('2d');
            var video = document.createElement('video');
            video.src = z;

            video.addEventListener('loadedmetadata', function () {
                canvas.width = video.videoWidth;
                canvas.height = video.videoHeight;
            });

            video.addEventListener('play', function () {
                var $this = this; //cache
                (function loop() {
                    if (!$this.paused && !$this.ended) {
                        ctx.drawImage($this, 0, 0);
                        setTimeout(loop, 1000 / 30); // 30fps
                    }
                })();
            }, 0);
            video.play()

            document.querySelector('.zfc').addEventListener('click', () => {

                if (video.paused) {
                    video.play()
                } else {
                    video.pause()
                }
            })
        }


        // bu url adresini session token post ederek json şeklinde alabilirsiniz.
        var zfc = startPlayer('http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');






    </script>






</body>

</html>