MM5 mainplayer skin display bitrate or genre

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: MM5 mainplayer skin display bitrate or genre

Re: MM5 mainplayer skin display bitrate or genre

by Radon » Thu Sep 30, 2021 9:40 am

Thanks for the answer,
that helps me in any case.

Re: MM5 mainplayer skin display bitrate or genre

by MiPi » Thu Sep 30, 2021 3:15 am

1) I am not sure, why do you need this. But it is defined in skin - player.html. "data-id" property is usually not needed for styling at all, as different skin can use different id. So when adding new element in some skin, you can use your own data-id (only e.g. if used in player.html, it should be unique in parent element, here in player element). Data-id is not bound to contents of the element.

2) controls on player are defined in window.playerControlsHandlers object in controls/player.js. So e.g. when you need to add bitrate to player control, you should:
add controls\player_add.js to your new skin, with:

Code: Select all

window.playerControlsHandlers.bitrate = {
        title: _('Bitrate'),
        setValue: function (el, playerCtrl, sd) {
            let bitrate = sd.bitrate;
            if (bitrate >= 0)
                el.innerText = Math.round(bitrate / 1000) +' '+_('kbps');
            else
                el.innerText = '';
        },
        grouptitle: playerControlGroups.metadata
    };
"grouptitle" defines section of player layout options, where new element should be displayed (sections are defined in playerControlGroups variable in player.js). And then add this control to player.html of your skin. Reference to playerControlsHandlers is done by attribute "data-player-control" containing name of the property defined above (this element will be passed to setValue function as first parameter, third parameter - "sd" - is standard SongListData object, setValue is called automatically when needed). So e.g. you can add this just after player-rating div, when you are adjusting Material Design skin:

Code: Select all

                <div class="verticalCenter dynamic">
                    <label data-id="player-bitrate" data-player-control="bitrate" data-optional="{group: 20, order: 30}" style="display: none"></label>
                </div>
As a result, bitrate will be displayed after (optional) rating, when checked in Player layout options (position in layout options defined in data-optional).
For file extension you can use exactly the same, in setValue you get extension from "sd.fileType".

MM5 mainplayer skin display bitrate or genre

by Radon » Wed Sep 29, 2021 12:37 am

Hello, and
sorry for my English is unfortunately not so good,
my native language is German. I hope you understand
my 2 questions yet.

1.
How do I get the names for "data-id" like "data-id='player-title'"?
Example for bitrate or file-extension or album or genre to address them
in the Player.html and skin_player_add.less ?

2.
I want to show the bitrate and file extension in the player.
If possible in the same line as the title only right-aligned ?

About a solution or idea I would be happy.

Thank You

Top