From c7c2b4a844f4e03e77418021122cc2dfa756ec50 Mon Sep 17 00:00:00 2001 From: Stefano Russello <stefano.russello@streamamg.com> Date: Fri, 29 Nov 2024 10:25:22 +0100 Subject: [PATCH] CORE-5100 Playlist documentation Applying @artem-y-pamediagroup suggestions on PR #29 - Fix Typo on GetStarted tutorial - Example multiline improving readability --- README.md | 29 +++++++++++++------ .../Tutorial/GetStarted.tutorial | 2 +- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 2187119..12f2957 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,10 @@ To load the player UI in your application, use the `loadPlayer` method of the `P Example: ```swift -PlaybackSDKManager.shared.loadPlayer(entryID: entryId, authorizationToken: authorizationToken) { error in +PlaybackSDKManager.shared.loadPlayer( + entryID: entryId, + authorizationToken: authorizationToken +) { error in // Handle player UI error } ``` @@ -99,7 +102,11 @@ To load a sequential list of videos into the player UI, use the `loadPlaylist` m Example: ```swift -PlaybackSDKManager.shared.loadPlayer(entryIDs: listEntryId, entryIDToPlay: "0_xxxxxxxx", authorizationToken: authorizationToken) { errors in +PlaybackSDKManager.shared.loadPlayer( + entryIDs: listEntryId, + entryIDToPlay: "0_xxxxxxxx", + authorizationToken: authorizationToken +) { errors in // Handle player UI playlist errors } ``` @@ -145,16 +152,20 @@ Example: ```swift @StateObject private var pluginManager = VideoPlayerPluginManager.shared ... -PlaybackSDKManager.shared.loadPlaylist(entryIDs: entryIDs, entryIDToPlay: entryIDToPlay, authorizationToken: authorizationToken) { errors in +PlaybackSDKManager.shared.loadPlaylist( + entryIDs: entryIDs, + entryIDToPlay: entryIDToPlay, + authorizationToken: authorizationToken +) { errors in ... - } - .onReceive(pluginManager.selectedPlugin!.event) { event in - if let event = event as? PlaylistTransitionEvent { // Playlist Event - if let from = event.from.metadata?["entryId"], let to = event.to.metadata?["entryId"] { - print("Playlist event changed from \(from) to \(to)") - } +} +.onReceive(pluginManager.selectedPlugin!.event) { event in + if let event = event as? PlaylistTransitionEvent { // Playlist Event + if let from = event.from.metadata?["entryId"], let to = event.to.metadata?["entryId"] { + print("Playlist event changed from \(from) to \(to)") } } +} ``` # Playing Access-Controlled Content diff --git a/Sources/PlaybackSDK/Documentation.docc/Tutorial/GetStarted.tutorial b/Sources/PlaybackSDK/Documentation.docc/Tutorial/GetStarted.tutorial index d11b8c2..6e47dad 100644 --- a/Sources/PlaybackSDK/Documentation.docc/Tutorial/GetStarted.tutorial +++ b/Sources/PlaybackSDK/Documentation.docc/Tutorial/GetStarted.tutorial @@ -46,7 +46,7 @@ To load a playlist and handle errors, use the **loadPlaylist** function provided by the Playback SDK to initialize and load the video player. This function takes an array of entry IDs, the starting entry ID, and an authorization token as parameters. Additionally, it includes a closure to handle any potential playlist errors that may occur during the loading process. The **handlePlaybackErrors** function is called within the closure to handle the playlist errors. It iterates through an array of **PlaybackError** objects and, for each error, switches on the error type to provide appropriate error handling. The code also includes a placeholder comment to indicate where the removal of the player can be implemented in the **onDisappear** modifier. - f you want to allow users to access free content or implement a guest mode, you can pass an empty string or **nil** value as the **authorizationToken** when calling the **loadPlaylist** function. This will bypass the need for authentication, enabling unrestricted access to the specified content. + If you want to allow users to access free content or implement a guest mode, you can pass an empty string or **nil** value as the **authorizationToken** when calling the **loadPlaylist** function. This will bypass the need for authentication, enabling unrestricted access to the specified content. @Code(name: "PlayerTestPlaylistView.swift", file: PlayerTestPlaylistView.swift) }