コード例 #1
0
        private PlaylistItem CreatePlaylistItem(BaseItem item, long startPostionTicks, string serverAddress)
        {
            var streams = _itemRepository.GetMediaStreams(new MediaStreamQuery {
                ItemId = item.Id
            }).ToList();

            var playlistItem = PlaylistItem.GetBasicConfig(item, _transcodeSettings);

            playlistItem.StartPositionTicks = startPostionTicks;

            if (playlistItem.IsAudio)
            {
                playlistItem.StreamUrl = StreamHelper.GetAudioUrl(playlistItem, serverAddress);
            }
            else
            {
                playlistItem.StreamUrl = StreamHelper.GetVideoUrl(_device.Properties, playlistItem, streams, serverAddress);
            }

            var didl = DidlBuilder.Build(item, _session.UserId.ToString(), serverAddress, playlistItem.StreamUrl, streams);

            playlistItem.Didl = didl;

            var header = StreamHelper.GetDlnaHeaders(playlistItem);

            playlistItem.DlnaHeaders = header;
            return(playlistItem);
        }
コード例 #2
0
        private PlaylistItem CreatePlaylistItem(BaseItem item, User user, long startPostionTicks, string mediaSourceId, int?audioStreamIndex, int?subtitleStreamIndex)
        {
            var deviceInfo = _device.Properties;

            var profile = _dlnaManager.GetProfile(deviceInfo.ToDeviceIdentification()) ??
                          _dlnaManager.GetDefaultProfile();

            var hasMediaSources = item as IHasMediaSources;
            var mediaSources    = hasMediaSources != null
                ? (_mediaSourceManager.GetStaticMediaSources(hasMediaSources, true, user)).ToList()
                : new List <MediaSourceInfo>();

            var playlistItem = GetPlaylistItem(item, mediaSources, profile, _session.DeviceId, mediaSourceId, audioStreamIndex, subtitleStreamIndex);

            playlistItem.StreamInfo.StartPositionTicks = startPostionTicks;

            playlistItem.StreamUrl = playlistItem.StreamInfo.ToDlnaUrl(_serverAddress, _accessToken);

            var itemXml = new DidlBuilder(profile, user, _imageProcessor, _serverAddress, _accessToken, _userDataManager, _localization, _mediaSourceManager, _logger, _libraryManager)
                          .GetItemDidl(item, null, _session.DeviceId, new Filter(), playlistItem.StreamInfo);

            playlistItem.Didl = itemXml;

            return(playlistItem);
        }
コード例 #3
0
        private PlaylistItem CreatePlaylistItem(BaseItem item, long startPostionTicks, string serverAddress)
        {
            var deviceInfo = _device.Properties;

            var profile = _dlnaManager.GetProfile(deviceInfo.ToDeviceIdentification()) ??
                          _dlnaManager.GetDefaultProfile();

            var mediaSources = item is Audio || item is Video
                ? _dtoService.GetMediaSources(item)
                : new List <MediaSourceInfo>();

            var playlistItem = GetPlaylistItem(item, mediaSources, profile, _session.DeviceId);

            playlistItem.StreamInfo.StartPositionTicks = startPostionTicks;

            playlistItem.StreamUrl = playlistItem.StreamInfo.ToUrl(serverAddress);

            var itemXml =
                new DidlBuilder(profile, _imageProcessor, serverAddress, _dtoService).GetItemDidl(item, _session.DeviceId,
                                                                                                  new Filter());

            playlistItem.Didl = itemXml;

            return(playlistItem);
        }