shaka-project / shaka-player

JavaScript player library / DASH & HLS client / MSE-EME player
Apache License 2.0
7.18k stars 1.34k forks source link

How to disable PictureInPicture in shaka player #5991

Closed vicky-allen closed 11 months ago

vicky-allen commented 11 months ago

I am using shaka player to play video, I am getting picture in picture option on menu items along with quality, language and playback speed

I want to disable picture in picture from list

I tried to add disablePictureInPicture in video player but still getting PIP

  <video
        className="w-full h-full"
        data-testid="video-element"
        ref={videoRef}
        poster={posterUrl}
        autoPlay
        disablePictureInPicture
      ></video>

I tried to add custom configuration as well

 player.configure({
      abr: { enabled: true},
      streaming: {
        rebufferingGoal: 5,
        bufferBehind: 10*60,
        bufferingGoal: 30,
        failureCallback: failureCallbackHandler
      },
      'overflowMenuButtons' : ['quality','language','playback_rate']
    });

Still seeing PIP in UI

Also tried using native video player element

 videoRef.current.setAttribute('disablepictureinpicture', 'true');
      videoRef.current.disablePictureInPicture = true   

Still seeing PictureInPicture video player Is there a way to disable PictureInPicture in shaka player

avelad commented 11 months ago

There is a bug when disabling PiP; so I changed the question to bug.

avelad commented 11 months ago

I have created https://github.com/shaka-project/shaka-player/pull/5992 to fix it.

In the meantime, I recommend that you use the UI configuration, in the example you have given you are using the player configuration.

I tried to add custom configuration as well

 player.configure({
      abr: { enabled: true},
      streaming: {
        rebufferingGoal: 5,
        bufferBehind: 10*60,
        bufferingGoal: 30,
        failureCallback: failureCallbackHandler
      },
      'overflowMenuButtons' : ['quality','language','playback_rate']
    });

Should be:

ui.configure({
       'overflowMenuButtons' : ['quality','language','playback_rate']
});

More info in: https://shaka-player-demo.appspot.com/docs/api/tutorial-ui-customization.html

vicky-allen commented 11 months ago

Thanks @avelad i was able to configure with ui.configure