private async Task LoadMedia(string title)
        {
            while (_controller == null)
            {
                await Task.Delay(500);
            }

            Uri uriResult;
            var isRemote = Uri.TryCreate(_mediaPath, UriKind.Absolute, out uriResult) &&
                           (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);

            Track track = null;

            if (!string.IsNullOrEmpty(_subtitleFilePath))
            {
                var message = MimeMessage.Load(_subtitleFilePath);
                _subtitleServer = await _fileServerService.StartStaticFileServer(_subtitleFilePath,
                                                                                 message.BodyParts.FirstOrDefault().ContentType.Name, 9001);

                track = new Track
                {
                    Name           = "Subtitle",
                    TrackId        = 100,
                    Type           = "TEXT",
                    SubType        = "captions",
                    TrackContentId =
                        $"http://{LocalIPAddress()}:9001"
                };
            }

            var metadata = new GenericMediaMetadata {
                title = title
            };

            if (!isRemote)
            {
                try
                {
                    var message = MimeMessage.Load(_mediaPath);
                    _mediaServer =
                        await _fileServerService.StartStreamFileServer(_mediaPath,
                                                                       message.BodyParts.FirstOrDefault().ContentType.Name, 9000);

                    await _controller.LoadMedia($"http://{LocalIPAddress()}:9000",
                                                message.BodyParts.FirstOrDefault().ContentType.Name, metadata, "LIVE",
                                                0D, null, track == null?null : new[] { track }, new[] { 100 });
                }
                catch (Exception ex)
                {
                    Logger.Error(ex);
                    Messenger.Default.Send(
                        new UnhandledExceptionMessage(
                            new PopcornException(LocalizationProviderHelper.GetLocalizedValue <string>("CastFailed"))));
                }
            }
            else
            {
                if (track != null)
                {
                    await _controller.LoadMedia(_mediaPath, "video/mp4", metadata, "BUFFERED", 0D,
                                                null, new[] { track },
                                                new[] { 100 });
                }
                else
                {
                    await _controller.LoadMedia(_mediaPath, "video/mp4", metadata, "BUFFERED");
                }
            }
        }