Defines an information about media currently controlled by the AVTransport instance.
Exemplo n.º 1
0
        /// <summary>
        ///       Returns information associated with the current media of the specified instance.
        /// </summary>
        /// <param name="instanceId">
        ///      Identifies the virtual instanceId of the AVTransport service to which the action applies.
        /// </param>
        /// <returns>
        ///     An instance of <see cref="RendererMediaInfo"/> which defines information about currently current media.
        /// </returns>
        /// <exception cref="WebException">
        ///     An error occurred when sending request to service.
        /// </exception>
        /// <exception cref="FormatException">
        ///     Received result is in a bad format.
        /// </exception>
        /// <exception cref="UPnPServiceException">
        ///     An internal service error occurred when executing request.
        /// </exception>
        public async Task <RendererMediaInfo> GetMediaInfoAsync(uint instanceId)
        {
            var arguments = new Dictionary <string, object> {
                { "InstanceID", instanceId }
            };

            var response = await this.InvokeActionAsync("GetMediaInfo", arguments);

            var mediaInfo = new RendererMediaInfo
            {
                NumberOfTracks     = response.GetValueOrDefault <int>("NrTracks"),
                MediaDuration      = ParsingHelper.ParseTimeSpan(response.GetValueOrDefault <string>("MediaDuration")),
                CurrentUri         = response.GetValueOrDefault <Uri>("CurrentURI"),
                CurrentUriMetadata = response.GetValueOrDefault <string>("CurrentURIMetaData"),
                NextUri            = response.GetValueOrDefault <Uri>("NextURI"),
                NextUriMetadata    = response.GetValueOrDefault <string>("NextURIMetaData"),
                PlaybackMedium     = response.GetValueOrDefault <string>("PlayMedium"),
                RecordMedium       = response.GetValueOrDefault <string>("RecordMedium"),
                WriteStatus        = response.GetValueOrDefault <bool>("WriteStatus")
            };

            return(mediaInfo);
        }
Exemplo n.º 2
0
		/// <summary>
		///       Returns information associated with the current media of the specified instance.
		/// </summary>
		/// <param name="instanceId">
		///      Identifies the virtual instanceId of the AVTransport service to which the action applies.
		/// </param>
		/// <returns>
		///     An instance of <see cref="RendererMediaInfo"/> which defines information about currently current media.
		/// </returns>
		/// <exception cref="WebException">
		///     An error occurred when sending request to service.
		/// </exception>
		/// <exception cref="FormatException">
		///     Received result is in a bad format.
		/// </exception>
		/// <exception cref="UPnPServiceException">
		///     An internal service error occurred when executing request.
		/// </exception>
		public async Task<RendererMediaInfo> GetMediaInfoAsync(uint instanceId)
		{
			var arguments = new Dictionary<string, object> { { "InstanceID", instanceId } };

			var response = await this.InvokeActionAsync("GetMediaInfo", arguments);

			var mediaInfo = new RendererMediaInfo
								{
									NumberOfTracks = response.GetValueOrDefault<int>("NrTracks"),
									MediaDuration = ParsingHelper.ParseTimeSpan(response.GetValueOrDefault<string>("MediaDuration")),
									CurrentUri = response.GetValueOrDefault<Uri>("CurrentURI"),
									CurrentUriMetadata = response.GetValueOrDefault<string>("CurrentURIMetaData"),
									NextUri = response.GetValueOrDefault<Uri>("NextURI"),
									NextUriMetadata = response.GetValueOrDefault<string>("NextURIMetaData"),
									PlaybackMedium = response.GetValueOrDefault<string>("PlayMedium"),
									RecordMedium = response.GetValueOrDefault<string>("RecordMedium"),
									WriteStatus = response.GetValueOrDefault<bool>("WriteStatus")
								};

			return mediaInfo;
		}