Skip to content

Extra Metadata Loader theme controls

Brandon edited this page Oct 16, 2022 · 2 revisions

Integration of custom controls in custom themes

Full integration tutorial for theme developers is available in the Playnite documentation: https://playnite.link/docs/master/tutorials/themes/extensionIntegration.html

Visibility of elements according to extension installation status

Example:

[...]
<Grid Visibility="{PluginStatus Plugin=ExtraMetadataLoader_705fdbca-e1fc-4004-b839-1d040b8b4429, Status=Installed}">
[...]

It can also be used to return a bool value if used in another property.

Video control

<ContentControl x:Name="ExtraMetadataLoader_VideoLoaderControl" />

Video control Custom

This control is the same as the video control but can force to configure if the control can display controls or play sound

<ContentControl x:Name="ExtraMetadataLoader_VideoLoaderControl_Controls_Sound" />
<ContentControl x:Name="ExtraMetadataLoader_VideoLoaderControl_Controls_NoSound" />
<ContentControl x:Name="ExtraMetadataLoader_VideoLoaderControl_NoControls_NoSound" />
<ContentControl x:Name="ExtraMetadataLoader_VideoLoaderControl_NoControls_Sound" />

Video Playback controls for Fullscreen Mode

It's possible to create buttons that can interact with the video player controls:

<ToggleButtonEx x:Name="TrailerPlayToggleV" Width="60" Margin="0,0,10,0"
                Style="{DynamicResource TrailerPlayToggle}"
                IsChecked="{Binding ElementName=ExtraMetadataLoader_VideoLoaderControl_NoControls_Sound, Path=Content.SettingsModel.Settings.IsVideoPlaying, Mode=OneWay, FallbackValue={StaticResource False}}"
                Command="{Binding ElementName=ExtraMetadataLoader_VideoLoaderControl_NoControls_Sound, Path=Content.VideoPlayCommand}"/>

<ToggleButtonEx x:Name="TrailerMuteToggleV" Width="60" Margin="0,0,10,0"
                Style="{DynamicResource TrailerMuteToggle}"
                IsChecked="{Binding ElementName=ExtraMetadataLoader_VideoLoaderControl_NoControls_Sound, Path=Content.IsPlayerMuted, Mode=OneWay, FallbackValue={StaticResource False}}"
                Command="{Binding ElementName=ExtraMetadataLoader_VideoLoaderControl_NoControls_Sound, Path=Content.VideoMuteCommand}"/>

Logo control

<ContentControl x:Name="ExtraMetadataLoader_LogoLoaderControl" />

Extension settings

User settings

The source name of the plugin is ExtraMetadataLoader

Setting Type Default Description
EnableVideoPlayer bool true Indicates if the video player has been enabled in settings
AutoPlayVideos bool false Indicates if trailer videos should be automatically played when loaded
RepeatTrailerVideos bool false Indicates if trailer videos should be repeated when they finish playing
StartNoSound bool false Indicates if videos should start playing without sound
UseMicrotrailersDefault bool false Indicates if the microtrailer videos should be played by default
FallbackVideoSource bool true Indicates if other type of video should be played if selected video type is not found
DefaultVolume double 100 Indicates the default volume in percentage
VideoControlsOpacity double 0.3 Indicates the opacity of video controls
VideoControlsOpacityMouseOver double 1.0 Indicates the opacity of video controls when the mouse is hovering the player
VideoControlsVerticalAlignment VerticalAlignment Bottom Indicates the vertical alignment of the video controls inside the video player
EnableLogos bool true Indicates if logos are enabled in settings
LogoMaxWidth double 600 Indicates the maximum width of the logo configured in settings
LogoMaxHeight double 200 Indicates the maximum height of the logo configured in settings
LogoHorizontalAlignment HorizontalAlignment Center Indicates the horizontal alignment of the logo configured in settings
LogoVerticalAlignment VerticalAlignment Center Indicates the vertical alignment of the logo configured in settings

Binding example:

[...]
<StackPanel>
    <StackPanel.Style>
        <Style TargetType="StackPanel">
            <Setter Property="Visibility" Value="Collapsed" />
            <Style.Triggers>
                <DataTrigger Binding="{PluginSettings Plugin=ExtraMetadataLoader, Path=EnableVideoPlayer, FallbackValue=False}" Value="True">
                    <Setter Property="Visibility" Value="Visible" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </StackPanel.Style>
[...]

Extension data specific of the selected game

Setting Type Default Description
IsLogoAvailable bool false Indicates if logo is available
IsTrailerAvailable bool false Indicates if trailer video is available
IsMicrotrailerAvailable bool false Indicates if Microtrailer video is available
IsAnyVideoAvailable bool false Indicates if trailer or microtrailer video is available
IsVideoPlaying bool false Indicates if a video is currently being played
NewContextVideoAvailable bool false Indicates if new game context has a video available for playing

Binding example:

[...]
<StackPanel>
    <StackPanel.Style>
        <Style TargetType="StackPanel">
            <Setter Property="Visibility" Value="Collapsed" />
            <Style.Triggers>
                <DataTrigger Binding="{PluginSettings Plugin=ExtraMetadataLoader, Path=IsAnyVideoAvailable, FallbackValue=False}" Value="True">
                    <Setter Property="Visibility" Value="Visible" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </StackPanel.Style>
[...]