Closed rogerkerse closed 2 years ago
You can configure this getLicense
for iOS function (I do not use it for android). It manually switches from the base 64 string form into a simple octet-stream that Axinom needs :)
import { Buffer } from 'buffer' // provided by react-native
....
<Video
...
getLicense={
async (
spc: string,
_contentId: string,
licenseURL: string
) => {
try {
const blob = Buffer.from(spc, 'base64')
const licenseResponse = await fetch(licenseURL, {
method: 'POST',
headers: {
'Content-Type': 'application/octet-stream',
// TODO: Add axinom details here, or better run them through a proxy server that adds X-AxDRM-Message
},
body: blob,
})
const licenseBlob = await licenseResponse.blob()
// manually convert the blob into an octet-stream
const license = await new Promise((resolve, reject) => {
const reader = new FileReader() // use file reader to avoid external dependencies
reader.onload = () => {
const dataURL = reader.result
resolve(
// @ts-ignore
dataURL.replace(
'data:application/octet-stream;base64,',
''
)
)
}
reader.onerror = err => {
console.error('could not turn license data into blob', err)
reject(err)
}
reader.readAsDataURL(licenseBlob)
})
return license
} catch (e) {
console.error('could not get license', e)
}
}
}
/>
A pr has been merge to fix the issue, is it solved ?
Bug
With "react-native-video": "5.1.0-alpha8" fairplay drm videos worked fine. When upgrading to "react-native-video": "5.1.1" we started getting the following error. Nothing else changed.
Platform
Which player are you experiencing the problem on:
Environment info
React native info output:
Library version: x.x.x
Steps To Reproduce
Expected behaviour
Reproducible sample code
Since it is a DRM content, I do not have precise urls to give, but I used props in following way. The only thing that stopped videos from playing was updating the patch version.
Props are following:
Video sample
-