Skip to content

Commit

Permalink
CORE-5100 Playlist documentation
Browse files Browse the repository at this point in the history
Applying @artem-y-pamediagroup suggestions on PR #29
- Fix Typo on GetStarted tutorial
- Example multiline improving readability
  • Loading branch information
StefanoStream committed Nov 29, 2024
1 parent f224ab9 commit c7c2b4a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
29 changes: 20 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 
```
Expand All @@ -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
```
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit c7c2b4a

Please sign in to comment.