aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.UI/Playback/InternalPlayer/BaseInternalMediaPlayer.cs
blob: 0c75190ce730716b15aa45ed28f92de20cdcb8ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using MediaBrowser.Model.DTO;
using MediaBrowser.UI.Configuration;
using System.Collections.Generic;
using System.Windows;

namespace MediaBrowser.UI.Playback.InternalPlayer
{
    /// <summary>
    /// Class BaseInternalMediaPlayer
    /// </summary>
    public abstract class BaseInternalMediaPlayer : BaseMediaPlayer
    {
        /// <summary>
        /// Ensures the media player created.
        /// </summary>
        protected abstract void EnsureMediaPlayerCreated();

        /// <summary>
        /// Plays the internal.
        /// </summary>
        /// <param name="items">The items.</param>
        /// <param name="options">The options.</param>
        /// <param name="playerConfiguration">The player configuration.</param>
        protected override void PlayInternal(List<DtoBaseItem> items, PlayOptions options, PlayerConfiguration playerConfiguration)
        {
            App.Instance.ApplicationWindow.Dispatcher.Invoke(() =>
            {
                App.Instance.ApplicationWindow.BackdropContainer.Visibility = Visibility.Collapsed;
                App.Instance.ApplicationWindow.WindowBackgroundContent.SetResourceReference(FrameworkElement.StyleProperty, "WindowBackgroundContentDuringPlayback");
            });

            App.Instance.NavigateToInternalPlayerPage();
        }

        /// <summary>
        /// Called when [player stopped internal].
        /// </summary>
        protected override void OnPlayerStoppedInternal()
        {
            App.Instance.ApplicationWindow.Dispatcher.Invoke(() =>
            {
                App.Instance.ApplicationWindow.BackdropContainer.Visibility = Visibility.Visible;
                App.Instance.ApplicationWindow.WindowBackgroundContent.SetResourceReference(FrameworkElement.StyleProperty, "WindowBackgroundContent");
            });
            
            base.OnPlayerStoppedInternal();
        }
    }
}