Beispiel #1
0
        public Media GetMedia(StartupConfiguration startupConfiguration)
        {
            var media = new Media(LibVLC, startupConfiguration.FilePath);

            if (Settings.UseHardwareAcceleration)
            {
                var configuration = new MediaConfiguration();
                configuration.EnableHardwareDecoding = true;
                media.AddOption(configuration);
            }
            //if (!startupConfiguration.AutoPlay)
            //{
            //    media.AddOption(":start-paused");
            //}
            if (!string.IsNullOrWhiteSpace(Settings.MediaOption))
            {
                try
                {
                    media.AddOption(Settings.MediaOption);
                }
                catch (Exception ex)
                {
                    App.DebugLog(ex.ToString());
                }
            }
            if (startupConfiguration.IsFileSubtitlesSelected)
            {
                media.AddOption(startupConfiguration.SelectedSubtitlesFile.EncodingOption);
            }
            //media.AddOption(":freetype-font=/storage/emulated/0/Download/arial.ttf");
            //media.AddOption(":freetype-color=16711680");
            foreach (var sub in startupConfiguration.ExternalSubtitles)
            {
                media.AddSlave(MediaSlaveType.Subtitle, 0, sub.FileUrl);
            }

            return(media);
        }