Commit bbce6848 authored by David Edmundson's avatar David Edmundson

Make content-script media player code follow user settings

Summary:
If a user disables the mpris plugin there's no point loading anything in
the client page.

Also split the mediaSessions shim into a separate option as it's much
more invasive than the regular mpris controls.

For now the latter is disabled by default. It breaks some sites, we
can't afford to do that and we need to put a fix for that immediately.

We can revisit it later.

Test Plan:
Ran media-sessions API page
With extended mpris on I got thumbnails
With it off I still had the classic video control

Reviewers: fvogt, broulik

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D13628
parent 576adffc
......@@ -31,6 +31,15 @@
"message": "Lets you control video and audio players in websites using the Media Controller plasmoid."
},
"options_plugin_mpris_media_sessions_title": {
"description": "Title for MediaSessions API Control plugin",
"message": "Enhanced Media Controls"
},
"options_plugin_mpris_media_sessions_description": {
"description": "Description for MediaSessions API Control plugin",
"message": "Extract metadata and thumbnails of currently playing content. (Experimental)"
},
"options_plugin_kdeconnect_title": {
"description": "Title for KDE Connect plugin",
"message": "Send via KDE Connect"
......
/*
Copyright (C) 2017 Kai Uwe Broulik <kde@privat.broulik.de>
Copyright (C) 2018 David Edmundson <davidedmundson@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
......@@ -19,6 +20,9 @@ DEFAULT_EXTENSION_SETTINGS = {
mpris: {
enabled: true
},
mprisMediaSessions: {
enabled: false
},
kdeconnect: {
enabled: true
},
......
This diff is collapsed.
......@@ -27,6 +27,12 @@
</label>
<p data-i18n="options_plugin_mpris_description">I18N</p>
</li>
<li>
<label>
<input type="checkbox" data-extension="mprisMediaSessions"> <span data-i18n="options_plugin_mpris_media_sessions_title">I18N</span>
</label>
<p data-i18n="options_plugin_mpris_media_sessions_description">I18N</p>
</li>
<li>
<label>
<input type="checkbox" data-extension="kdeconnect"> <span data-i18n="options_plugin_kdeconnect_title">I18N</span>
......
/*
Copyright (C) 2017 Kai Uwe Broulik <kde@privat.broulik.de>
Copyright (C) 2018 David Edmundson <davidedmundson@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
......@@ -129,6 +130,13 @@ document.addEventListener("DOMContentLoaded", function () {
});
}
var mpris = document.querySelectorAll("[data-extension=mpris]")[0];
var mprisEx = document.querySelectorAll("[data-extension=mprisMediaSessions]")[0];
mpris.addEventListener("change", function() {
mprisEx.disabled = !mpris.checked;
});
mprisEx.disabled = !mpris.checked;
// check whether the platform is supported before loading and activating settings
chrome.runtime.getPlatformInfo(function (info) {
if (!SUPPORTED_PLATFORMS.includes(info.os)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment