Example #1
0
        public async Task StartNewAsync(IEnumerable <string> uris, string offset = null, TimeSpan?position = null, CancellationToken cancellationToken = default)
        {
            SpotifyArgumentAssertUtils.ThrowIfNull(uris, nameof(uris));

            var request = new StartNewPlaybackRequest
            {
                Uris   = uris.ToArray(),
                Offset = offset != null ? new Offset {
                    Uri = offset
                } : null,
                Position = position
            };

            await this.SendBodyAsync(
                HttpMethod.Put,
                request,
                cancellationToken,
                additionalRouteValues : new[] { "play" },
                queryParams : new { device_id = this.deviceId });
        }
Example #2
0
        public async Task StartNewAsync(string contextUri, int?offset = null, TimeSpan?position = null, CancellationToken cancellationToken = default)
        {
            SpotifyArgumentAssertUtils.ThrowIfNullOrEmpty(contextUri, nameof(contextUri));

            var request = new StartNewPlaybackRequest
            {
                ContextUri = contextUri,
                Offset     = offset != null ? new Offset {
                    Position = offset
                } : null,
                Position = position
            };

            await this.SendBodyAsync(
                HttpMethod.Put,
                request,
                cancellationToken,
                additionalRouteValues : new[] { "play" },
                queryParams : new { device_id = this.deviceId });
        }