videojs / http-streaming

HLS, DASH, and future HTTP streaming protocols library for video.js
https://videojs-http-streaming.netlify.app/
Other
2.53k stars 425 forks source link

`xhr-hooks-ready` not working with overrideNative : true #1520

Closed minna-no-jihye closed 4 months ago

minna-no-jihye commented 5 months ago

Description

I used the videojs-contrib-eme library for DRM decryption, I activated overrideNative to 'true' in the mac os Safari environment. The problem occurs when trying to use the xhr-hooks-ready functionality. When overrideNative is activated, the xhr-hooks-readyevent does not trigger specifically for HLS videos.

Is the issue above a bug or is there a separate way to generate an event?

videojs-contrib-eme: 3.11.2 Configuration:

Sources

const player = videojs('my-player', {
        autoplay: false,
        preload: 'none',
        controls: true,
        responsive: false,
        fluid: true,
        muted: true,
        playsinline: true,
        controlBar: {
            pictureInPictureToggle: false,
            qualitySelector: true,
            volumePanel: { inline: false },
        },
        html5: {
            // VHS has to be present for Safari (macOS) to pic up the video stream.
            vhs: {
                withCredentials: false,
                maxPlaylistRetries: 2,
                useDevicePixelRatio: true,
                // NOTE: The NetworkInformationAPI appears to make things higher quality on Safari.
                useNetworkInformationApi: true,
                // NOTE: this overrides the native HLS support for Safari which in turn activates the ability to more finely control the resolutionavailable and logging to console.
                // This can be deactivated and it will use the quality level appropriate for the internet speed, screen resolution, pixel density.
                overrideNative: !videojs.browser.IS_SAFARI,
            },
            nativeAudioTracks: videojs.browser.IS_SAFARI,
            nativeVideoTracks: videojs.browser.IS_SAFARI,
        },
    }

);

 const playerConfig = {
        src: "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
        type: "application/x-mpegURL"
    }

 player.on('xhr-hooks-ready', () => {
        const playerRequestHook = (options) => {
            options.uri += "?query-param=value"
            console.log("uri: ", options.uri)
            return options
        };
        // ref: https://github.com/videojs/http-streaming/blob/main/README.md#vhsxhr    
        player.tech().vhs.xhr.onRequest(playerRequestHook);
 })

player.src(playerConfig);

videojs version

videojs version: 8.11.0

Browsers

mac os safari 17.2.1

welcome[bot] commented 5 months ago

👋 Thanks for opening your first issue here! 👋

If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. To help make it easier for us to investigate your issue, please follow the contributing guidelines.

mister-ben commented 4 months ago

overrideNative: !videojs.browser.IS_SAFARI would be overrideNative: false on Safari, so VHS would not be used or playback.