-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from StreamAMG/release/1.3.0
Release/1.3.0
- Loading branch information
Showing
77 changed files
with
1,602 additions
and
398 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Sources/PlaybackSDK/Documentation.docc/Resources/InstallPlayerPluginTutorial.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Sources/PlaybackSDK/Documentation.docc/Resources/LoadPlayerViewTutorial.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...es/PlaybackSDK/Documentation.docc/Resources/PlayerTestPlaylistControlsAndEventsView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import SwiftUI | ||
import PlaybackSDK | ||
|
||
struct PlayerTestPlaylistControlsAndEventsView: View { | ||
|
||
@StateObject private var pluginManager = VideoPlayerPluginManager.shared | ||
private let entryIDs = ["ENTRY_ID1", "ENTRY_ID_2", "ENTRY_ID_3"] | ||
private let entryIDToPlay = "ENTRY_ID_2" // Optional parameter | ||
private let entryIdToSeek = "ENTRY_ID_TO_SEEK" | ||
private let authorizationToken = "JWT_TOKEN" | ||
|
||
var body: some View { | ||
VStack { | ||
// Load playlist with the playback SDK | ||
PlaybackSDKManager.shared.loadPlaylist(entryIDs: entryIDs, entryIDToPlay: entryIDToPlay, authorizationToken: authorizationToken) { errors in | ||
handlePlaybackError(errors) | ||
} | ||
.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)") | ||
} | ||
} | ||
} | ||
.onDisappear { | ||
// Remove the player here | ||
} | ||
|
||
Spacer() | ||
|
||
Button { | ||
// You can use the following playlist controls | ||
pluginManager.selectedPlugin?.playFirst() // Play the first video | ||
pluginManager.selectedPlugin?.playPrevious() // Play the previous video | ||
pluginManager.selectedPlugin?.playNext() // Play the next video | ||
pluginManager.selectedPlugin?.playLast() // Play the last video | ||
pluginManager.selectedPlugin?.seek(entryIdToSeek) { success in // Seek a specific video | ||
if (!success) { | ||
let errorMessage = "Unable to seek video Id \(entryIdToSeek)" | ||
} | ||
} | ||
pluginManager.selectedPlugin?.activeEntryId() // Get the active video Id | ||
} label: { | ||
Image(systemName: "list.triangle") | ||
} | ||
|
||
Spacer() | ||
} | ||
.padding() | ||
} | ||
|
||
private func handlePlaybackErrors(_ errors: [PlaybackAPIError]) { | ||
|
||
for error in errors { | ||
switch error { | ||
case .apiError(let statusCode, let message, let reason): | ||
let message = "\(message) Status Code \(statusCode), Reason: \(reason)" | ||
print(message) | ||
default: | ||
print("Error code and errorrMessage not found: \(error.localizedDescription)") | ||
} | ||
} | ||
} | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
Sources/PlaybackSDK/Documentation.docc/Resources/PlayerTestPlaylistView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import SwiftUI | ||
import PlaybackSDK | ||
|
||
struct PlayerTestPlaylistView: View { | ||
|
||
private let entryIDs = ["ENTRY_ID1", "ENTRY_ID_2", "ENTRY_ID_3"] | ||
private let entryIDToPlay = "ENTRY_ID_2" // Optional parameter | ||
private let authorizationToken = "JWT_TOKEN" | ||
|
||
var body: some View { | ||
VStack { | ||
// Load playlist with the playback SDK | ||
PlaybackSDKManager.shared.loadPlaylist(entryIDs: entryIDs, entryIDToPlay: entryIDToPlay, authorizationToken: authorizationToken) { errors in | ||
handlePlaybackError(errors) | ||
} | ||
.onDisappear { | ||
// Remove the player here | ||
} | ||
Spacer() | ||
} | ||
.padding() | ||
} | ||
|
||
private func handlePlaybackErrors(_ errors: [PlaybackAPIError]) { | ||
|
||
for error in errors { | ||
switch error { | ||
case .apiError(let statusCode, let message, let reason): | ||
let message = "\(message) Status Code \(statusCode), Reason: \(reason)" | ||
print(message) | ||
default: | ||
print("Error code and errorrMessage not found: \(error.localizedDescription)") | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.