Bug 408059 - Plasma-browser-integration should set CanSetFullscreen/FullScreen mpris2 property for videos
Summary: Plasma-browser-integration should set CanSetFullscreen/FullScreen mpris2 prop...
Status: RESOLVED FIXED
Alias: None
Product: plasma-browser-integration
Classification: Plasma
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Kai Uwe Broulik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-29 10:24 UTC by Federico
Modified: 2019-06-17 13:09 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Federico 2019-05-29 10:24:13 UTC
SUMMARY
org.mpris.MediaPlayer2 supports a CanSetFullScreen property that is very useful to distinguish between audio and video playing.
I'd like plasma-browser-integration to provide the property together with its "FullScreen" counter-part.

STEPS TO REPRODUCE
1. Start playing video in vlc
2. busctl --user introspect org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2 shows:

.Quit                               method    -         -                                        -
.Raise                              method    -         -                                        -
.CanQuit                            property  b         true                                     emits-change
.CanRaise                           property  b         false                                    emits-change
.CanSetFullscreen                   property  b         true                                     emits-change
.DesktopEntry                       property  s         "vlc"                                    emits-change
.Fullscreen                         property  b         false                                    emits-change writable
.HasTrackList                       property  b         false                                    emits-change
.Identity                           property  s         "Lettore multimediale VLC"               emits-change

MORE...
 
3. Open a youtube video on firefox (same goes for chromium).
4. busctl --user introspect org.mpris.MediaPlayer2.plasma-browser-integration /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2 shows:

.Quit                               method    -         -                                        -
.Raise                              method    -         -                                        -
.CanQuit                            property  b         false                                    emits-change
.CanRaise                           property  b         true                                     emits-change
.DesktopEntry                       property  s         "firefox"                                emits-change
.HasTrackList                       property  b         false                                    emits-change
.Identity                           property  s         "Firefox Web Browser"                    emits-change
.SupportedMimeTypes                 property  as        0                                        emits-change
.SupportedUriSchemes                property  as        0                                        emits-change

OBSERVED RESULT
No property "CanSetFullScreen" is provided.

EXPECTED RESULT
"CanSetFullScreen" provided for videos only.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.15.4
KDE Frameworks Version: 5.56.0
Qt Version: 5.12.2

ADDITIONAL INFORMATION:
Tested on  Archlinux with kde 5.15.90 too. Still facing same "issue".
Comment 1 Kai Uwe Broulik 2019-05-29 10:54:18 UTC
I toyed around with it, however, most websites do something special when fullscreening the video. If I just blatantly call requestFullScreen() on the HTML5 video element on e.g. YouTube it horribly breaks, which is why I never bothered implementing this.
Comment 2 Federico 2019-05-29 10:59:29 UTC
I think this surely is a stupid idea, so forgive me if it actually is...but what about just pressing fullscreen button from code when FullScreen=true is requested?
This way it would be indistinguishable from a normal user "go-fullscreen" operation.
Comment 3 Kai Uwe Broulik 2019-05-29 11:06:03 UTC
It's surely not a stupid request :) What I can probably at least do is reflect the full screen state in the FullScreen property, setting full screen is an entirely different story.

I cannot really know what the fullscreen button is. Try for yourself on youtube, run the following in the developer console Ctrl+Shift+I:
document.querySelector("video").requestFullscreen()

I just tried with vimeo which works fine. So maybe we can do this after all and just have to live with the fact that sometimes it doesn't work as expected. Setting this as confirmed.
Comment 4 Federico 2019-05-29 12:29:54 UTC
> I cannot really know what the fullscreen button is.

I imagined that could cause some troubles.

> I just tried with vimeo which works fine. So maybe we can do this after all and just have to live with the fact that sometimes it doesn't work as expected. Setting this as confirmed.

This is great, thanks!
Comment 5 Kai Uwe Broulik 2019-06-17 13:09:27 UTC
Git commit 23d978c0ee173795d1d27609901bda82cd891875 by Kai Uwe Broulik.
Committed on 17/06/2019 at 13:08.
Pushed by broulik into branch 'master'.

Allow setting fullscreen via MPRIS

This implements CanSetFullscreen to return true when it's a video and lets the Fullscreen property reflect and change the fullscreen state of the player.

Differential Revision: https://phabricator.kde.org/D21554

M  +2    -5    dbus/org.mpris.MediaPlayer2.xml
M  +21   -1    extension/content-script.js
M  +7    -1    extension/extension.js
M  +35   -0    host/mprisplugin.cpp
M  +11   -0    host/mprisplugin.h

https://commits.kde.org/plasma-browser-integration/23d978c0ee173795d1d27609901bda82cd891875