Vicpa 559 Posted April 9 Share Posted April 9 Hi, My client uses the old version of the Api client. The playback reporting methods Start, Progress and Stop, are the area I could use some help Start method: fails looking for another property what else do I need to add ? The methods I am using are below: /// <summary> /// Reports playback start /// </summary> /// <param name="info">The information.</param> /// <param name="isOffline">if set to <c>true</c> [is offline].</param> /// <param name="apiClient">The current apiClient. It can be null if offline</param> /// <returns>Task.</returns> public async Task ReportPlaybackStart(PlaybackStartInfo info, bool isOffline, IApiClient apiClient) { if (!isOffline) { await apiClient.ReportPlaybackStartAsync(info).ConfigureAwait(false); } } /// <summary> /// Reports playback progress /// </summary> /// <param name="info">The information.</param> /// <param name="streamInfo">The stream information.</param> /// <param name="isOffline">if set to <c>true</c> [is offline].</param> /// <param name="apiClient">The current apiClient. It can be null if offline</param> /// <returns>Task.</returns> public async Task ReportPlaybackProgress(PlaybackProgressInfo info, StreamInfo streamInfo, bool isOffline, IApiClient apiClient) { if (!isOffline) { if (streamInfo != null) { info.PlaySessionId = streamInfo.PlaySessionId; if (streamInfo.MediaSource != null) { info.LiveStreamId = streamInfo.MediaSource.LiveStreamId; } } await apiClient.ReportPlaybackProgressAsync(info).ConfigureAwait(false); } } /// <summary> /// Reports playback progress /// </summary> /// <param name="info">The information.</param> /// <param name="streamInfo">The stream information.</param> /// <param name="serverId">The server identifier.</param> /// <param name="userId">The user identifier.</param> /// <param name="isOffline">if set to <c>true</c> [is offline].</param> /// <param name="apiClient">The current apiClient. It can be null if offline</param> /// <returns>Task.</returns> public async Task ReportPlaybackStopped(PlaybackStopInfo info, StreamInfo streamInfo, string serverId, string userId, bool isOffline, IApiClient apiClient) { if (isOffline) { var action = new UserAction { Date = DateTime.UtcNow, ItemId = info.ItemId, PositionTicks = info.PositionTicks, ServerId = serverId, Type = UserActionType.PlayedItem, UserId = userId }; await _localAssetManager.RecordUserAction(action).ConfigureAwait(false); return; } if (streamInfo != null) { info.PlaySessionId = streamInfo.PlaySessionId; if (streamInfo.MediaSource != null) { info.LiveStreamId = streamInfo.MediaSource.LiveStreamId; } } // Put a try/catch here because we need to stop transcoding regardless try { await apiClient.ReportPlaybackStoppedAsync(info).ConfigureAwait(false); } catch (Exception ex) { _logger.ErrorException("Error in ReportPlaybackStoppedAsync", ex); } } Thanks any help would be appreciated. -vicpa Link to comment Share on other sites More sharing options...
Luke 37084 Posted April 9 Share Posted April 9 Those calls should all include the PlaySessionId value that you got from the /PlaybackInfo call prior to playback. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now