AirenSoft / OvenPlayer

OvenPlayer is JavaScript-based LLHLS and WebRTC Player for OvenMediaEngine.
https://OvenMediaEngine.com/ovenplayer
MIT License
498 stars 124 forks source link

The event 'ready' does not process correctly. The array with getQualityLevels values ​​is empty #378

Closed Vladimir17111991 closed 5 months ago

Vladimir17111991 commented 9 months ago

Hi all. When I call the Ready event after the player is initialized, the getQualityLevels method returns empty values. You most likely transmit it via a link, but we have no way to track this occurrence. They appear after a certain period of time depending on the PC (in my case 250ms). I use OvenPlayer v. 0.10.31. Here's my code.

data() {
        return {
            player: null,
        };
    },

methods: {
   loadOvenPlayer() {
            if (this.player) {
                this.$emit('checkClientConditions', false);
                this.player.remove();
                this.player = null;
                this.setPlayer(null);
                this.setPlayerReady(false);
            }
            const options = {
                autoStart: true,
                autoFallback: true,
                controls: false,
                showBigPlayButton: false,
                mute: this.videoMuted,
                hlsConfig: {
                    xhrSetup(xhr) {
                        // Force to send cookies.
                        // eslint-disable-next-line no-param-reassign
                        xhr.withCredentials = true;
                    },
                },
                webrtcConfig: {
                    timeoutMaxRetry: 5,
                    connectionTimeout: 10000,
                },
                sources: this.getSources(this.clientId, this.playerName),
            };
            this.player = OvenPlayer.create('ovenplayer', options);
            this.setPlayer(this.player);
            // this.player.once('qualityLevelChanged', () => {
            //     setTimeout(() => {
            //     this.setPlayerReady(true);
            //     this.setQualityLevel(this.quality);
            //
            //     }, 300);
            // });
            this.player.on('ready', () => {
                console.log(this.player.getQualityLevels());
            });
            this.player.on('error', () => {
                setTimeout(() => {
                    this.loadOvenPlayer();
                }, 1000);
            });
        },
       },
SangwonOh commented 7 months ago

@Vladimir17111991 Hi. How about trying metachanged Event. https://airensoft.gitbook.io/ovenplayer/api-reference/events#on-metachanged

SangwonOh commented 5 months ago

We are closing the issue due to a long period of inactivity. If further discussion is needed, please reopen the issue.