diff --git a/Sources/PlaybackSDK/PlayBackSDKManager.swift b/Sources/PlaybackSDK/PlayBackSDKManager.swift index 666b928..181aab5 100644 --- a/Sources/PlaybackSDK/PlayBackSDKManager.swift +++ b/Sources/PlaybackSDK/PlayBackSDKManager.swift @@ -151,7 +151,7 @@ public class PlayBackSDKManager { entryID: String, authorizationToken: String? = nil, mediaTitle: String? = nil, - userId: String? = nil, + viewerId: String? = nil, onError: ((PlayBackAPIError) -> Void)? ) -> some View { @@ -159,7 +159,7 @@ public class PlayBackSDKManager { entryId: entryID, authorizationToken: authorizationToken, mediaTitle: mediaTitle, - userId: userId, + viewerId: viewerId, onError: onError ) .id(entryID) diff --git a/Sources/PlaybackSDK/Player Plugin/BitMovinPlugin/BitmovinPlayerPlugin.swift b/Sources/PlaybackSDK/Player Plugin/BitMovinPlugin/BitmovinPlayerPlugin.swift index 910f627..3e78ef9 100644 --- a/Sources/PlaybackSDK/Player Plugin/BitMovinPlugin/BitmovinPlayerPlugin.swift +++ b/Sources/PlaybackSDK/Player Plugin/BitMovinPlugin/BitmovinPlayerPlugin.swift @@ -39,23 +39,23 @@ public class BitmovinPlayerPlugin: VideoPlayerPlugin { playerConfig.styleConfig.userInterfaceConfig = uiConfig } - private func createAnalyticsConfig(userId: String? = nil) -> AnalyticsPlayerConfig { + private func createAnalyticsConfig(viewerId: String? = nil) -> AnalyticsPlayerConfig { guard let licenseKey = PlayBackSDKManager.shared.bitmovinLicense else { return .disabled } - let defaultMetadata = DefaultMetadata(cdnProvider: "PlaybackSDK", customUserId: userId) + let defaultMetadata = DefaultMetadata(cdnProvider: "PlaybackSDK", customUserId: viewerId) let analytics: BitmovinPlayerAnalytics.AnalyticsPlayerConfig = licenseKey != nil ? .enabled(analyticsConfig: AnalyticsConfig(licenseKey: licenseKey), defaultMetadata: defaultMetadata) : .disabled return analytics } - public func playerView(hlsURLString: String, title: String = "", userId: String? = nil) -> AnyView { + public func playerView(hlsURLString: String, title: String = "", viewerId: String? = nil) -> AnyView { // Create player based on player and analytics configurations let player = PlayerFactory.createPlayer( playerConfig: playerConfig, - analytics: self.createAnalyticsConfig(userId: userId) + analytics: self.createAnalyticsConfig(viewerId: viewerId) ) self.player = player diff --git a/Sources/PlaybackSDK/Player Plugin/VideoPlayerPlugin.swift b/Sources/PlaybackSDK/Player Plugin/VideoPlayerPlugin.swift index e8accd2..27599d6 100644 --- a/Sources/PlaybackSDK/Player Plugin/VideoPlayerPlugin.swift +++ b/Sources/PlaybackSDK/Player Plugin/VideoPlayerPlugin.swift @@ -19,7 +19,7 @@ public protocol VideoPlayerPlugin: AnyObject { // TODO: add event /// func handleEvent(event: BitmovinPlayerCore.PlayerEvent) - func playerView(hlsURLString: String, title: String, userId: String?) -> AnyView + func playerView(hlsURLString: String, title: String, viewerId: String?) -> AnyView func play() diff --git a/Sources/PlaybackSDK/PlayerUIView/PlaybackUIView.swift b/Sources/PlaybackSDK/PlayerUIView/PlaybackUIView.swift index 9fef3b2..7e4e380 100644 --- a/Sources/PlaybackSDK/PlayerUIView/PlaybackUIView.swift +++ b/Sources/PlaybackSDK/PlayerUIView/PlaybackUIView.swift @@ -23,7 +23,7 @@ internal struct PlaybackUIView: View { private var authorizationToken: String? /// Optional user ID to be tracked in analytics - private var userId: String? + private var viewerId: String? /// Observed object to manage the video player plugins. @ObservedObject private var pluginManager = VideoPlayerPluginManager.shared @@ -43,12 +43,12 @@ internal struct PlaybackUIView: View { - entryId: The entry ID of the video to be played. - authorizationToken: Optional authorization token if required to fetch the video details. */ - internal init(entryId: String, authorizationToken: String?, mediaTitle: String?, userId: String?, onError: ((PlayBackAPIError) -> Void)?) { + internal init(entryId: String, authorizationToken: String?, mediaTitle: String?, viewerId: String?, onError: ((PlayBackAPIError) -> Void)?) { self.entryId = entryId self.authorizationToken = authorizationToken self.onError = onError self.mediaTitle = mediaTitle - self.userId = userId + self.viewerId = viewerId } /// The body of the view. @@ -62,7 +62,7 @@ internal struct PlaybackUIView: View { } else { if let videoURL = videoURL { if let plugin = pluginManager.selectedPlugin { - plugin.playerView(hlsURLString: videoURL.absoluteString, title: self.mediaTitle ?? "", userId: self.userId) + plugin.playerView(hlsURLString: videoURL.absoluteString, title: self.mediaTitle ?? "", viewerId: self.viewerId) } else { ErrorUIView(errorMessage: "No plugin selected") .background(Color.white)