-
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.
- Loading branch information
1 parent
8ffb954
commit f2d7b61
Showing
8 changed files
with
178 additions
and
197 deletions.
There are no files selected for viewing
17 changes: 0 additions & 17 deletions
17
Sources/PlaybackSDK/Documentation.docc/Resources/InitializeSdkExample.swift
This file was deleted.
Oops, something went wrong.
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
18 changes: 0 additions & 18 deletions
18
Sources/PlaybackSDK/Documentation.docc/Resources/LoadPlayerViewTutorial.swift
This file was deleted.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
Sources/PlaybackSDK/Documentation.docc/Resources/PlayBackDemoApp.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,41 @@ | ||
// | ||
// InitializeSdkExample.swift | ||
// | ||
// | ||
// Created by Franco Driansetti on 27/02/2024. | ||
// | ||
|
||
import SwiftUI | ||
import PlaybackSDK | ||
|
||
@main | ||
struct PlayBackDemoApp: App { | ||
|
||
let sdkManager = PlayBackSDKManager() | ||
let apiKey = "API_KEY" | ||
var body: some Scene { | ||
WindowGroup { | ||
HomeView() | ||
} | ||
} | ||
|
||
init() { | ||
// Initialize the Playback SDK with the provided API key and base URL | ||
PlayBackSDKManager.shared.initialize(apiKey: apiKey) { result in | ||
switch result { | ||
case .success(let license): | ||
// Obtained license upon successful initialization | ||
print("SDK initialized with license: \(license)") | ||
|
||
// Register the video player plugin | ||
let bitmovinPlugin = BitmovinPlayerPlugin() | ||
VideoPlayerPluginManager.shared.registerPlugin(bitmovinPlugin) | ||
|
||
case .failure(let error): | ||
// Print an error message and set initializationError flag upon initialization failure | ||
print("SDK initialization failed with error: \(error)") | ||
|
||
} | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
Sources/PlaybackSDK/Documentation.docc/Resources/PlayerTestView.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,41 @@ | ||
// | ||
// LoadPlayerViewTutorial.swift | ||
// | ||
// | ||
// Created by Franco Driansetti on 27/02/2024. | ||
// | ||
|
||
import SwiftUI | ||
import PlaybackSDK | ||
|
||
struct PlayerTestView: View { | ||
|
||
private let entryID = "ENTRY_ID" | ||
private let authorizationToken = "JWT_TOKEN" | ||
|
||
var body: some View { | ||
VStack { | ||
// Load player with the playback SDK | ||
PlayBackSDKManager.shared.loadPlayer(entryID: entryID, authorizationToken: authorizationToken) { error in | ||
handlePlaybackError(error) | ||
} | ||
.onDisappear { | ||
// Remove the player here | ||
} | ||
Spacer() | ||
} | ||
.padding() | ||
} | ||
|
||
private func handlePlaybackError(_ error: PlaybackError) { | ||
switch error { | ||
case .apiError(let statusCode, let errorMessage): | ||
print("\(errorMessage) Status Code \(statusCode)") | ||
errorMessage = "\(errorMessage) Status Code \(statusCode)" | ||
default: | ||
print("Error loading HLS stream in PlaybackUIView: \(error.localizedDescription)") | ||
errorMessage = "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
Oops, something went wrong.