Skip to content

Commit

Permalink
Ok thats custom domains afaik
Browse files Browse the repository at this point in the history
  • Loading branch information
daytime-em committed May 1, 2024
1 parent c74f1bd commit db39e96
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Sources/MuxPlayerSwift/Fairplay/ContentKeySessionDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,17 @@ class ContentKeySessionDelegate : NSObject, AVContentKeySessionDelegate {
}
}

func makeLicenseUrl(playbackOptions: PlaybackOptions) -> String {
let customDomainWithDefault = playbackOptions.customDomain ?? "mux.com"
let licenseDomain = "license.\(customDomainWithDefault)"

if("staging.mux.com" == customDomainWithDefault) {
return "license.gcp-us-west1-vos1.staging.mux.com"
} else {
return licenseDomain
}
}

func handleContentKeyRequest(_ session: AVContentKeySession, request: AVContentKeyRequest) {
print("<><>handleContentKeyRequest: Called")
// for hls, "the identifier must be an NSURL that matches a key URI in the Media Playlist." from the docs
Expand All @@ -135,8 +146,7 @@ class ContentKeySessionDelegate : NSObject, AVContentKeySessionDelegate {
return
}

let customDomainWithDefault = playbackOptions.customDomain ?? "mux.com"
let licenseDomain = "license.\(customDomainWithDefault)"
let muxLicenseDomain = makeLicenseUrl(playbackOptions: playbackOptions)

// get app cert
var applicationCertificate: Data?
Expand Down Expand Up @@ -177,7 +187,7 @@ class ContentKeySessionDelegate : NSObject, AVContentKeySessionDelegate {
}
// step: exchange SPC for CKC using KeyRequest w/completion handler (request wants to know if failed)
// todo - drmToken from Asset
handleSpcObtainedFromCDM(spcData: spcData, playbackID: playbackID, drmToken: drmOptions.drmToken, domain: licenseDomain, request: request)
handleSpcObtainedFromCDM(spcData: spcData, playbackID: playbackID, drmToken: drmOptions.drmToken, domain: muxLicenseDomain, request: request)
}
}

Expand Down

0 comments on commit db39e96

Please sign in to comment.