/// <summary> /// Create or Update the watch history for this application /// </summary> private void SetUpWatchHistory() { MLResult result; List <MLScreensWatchHistoryEntry> history = MLScreens.GetAllEntries(); if (history.Count == 0) { // We have no history and need to create some. var entry = new MLScreensWatchHistoryEntry() { // Value should be ignored Id = long.MaxValue, Title = "NASA", Subtitle = "Cold Atom Laboratory", PlaybackPositionMs = (uint)_mediaPlayer.GetElapsedTimeMs(), PlaybackDurationMs = (uint)_mediaPlayer.GetDurationMs(), }; if (GetNewThumbnail()) { result = MLScreens.Add(ref entry, _thumbnail); } else { result = MLScreens.Add(ref entry, _defaultThumbnail); } } else { // We have existing History just update it with latest times and thumbnail var entry = history[0]; entry.PlaybackPositionMs = (uint)_mediaPlayer.GetElapsedTimeMs(); entry.PlaybackDurationMs = (uint)_mediaPlayer.GetDurationMs(); if (GetNewThumbnail()) { result = MLScreens.UpdateWatchHistory(entry, _thumbnail); } else { result = MLScreens.UpdateWatchHistory(entry, _defaultThumbnail); } } if (!result.IsOk) { Debug.LogErrorFormat("Error: ScreensExample MLScreens.UpdateWatchHistory failed. Reason {0}.", result); } }