Add support for unprotected MPEG-DASH streams (#111)

This commit is contained in:
mediaminister 2022-12-15 11:36:51 +01:00 committed by GitHub
parent 98a0ffb162
commit b7a479e585
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -361,23 +361,33 @@ class ContentApi:
raise UnavailableException
if 'videoDash' in data:
# DRM protected stream
# See https://docs.unified-streaming.com/documentation/drm/buydrm.html#setting-up-the-client
drm_key = data['drmKey']['S']
_LOGGER.debug('Fetching Authentication XML with drm_key %s', drm_key)
response_drm = self._get_url(self.API_GOPLAY + '/video/xml/%s' % drm_key, authentication=self._auth.get_token())
data_drm = json.loads(response_drm)
if 'drmKey' in data:
# DRM protected stream
# See https://docs.unified-streaming.com/documentation/drm/buydrm.html#setting-up-the-client
drm_key = data['drmKey']['S']
_LOGGER.debug('Fetching Authentication XML with drm_key %s', drm_key)
response_drm = self._get_url(self.API_GOPLAY + '/video/xml/%s' % drm_key, authentication=self._auth.get_token())
data_drm = json.loads(response_drm)
# DRM protected DASH stream
return ResolvedStream(
uuid=uuid,
url=data['videoDash']['S'],
stream_type=STREAM_DASH,
license_url='https://wv-keyos.licensekeyserver.com/',
auth=data_drm.get('auth'),
)
# Unprotected DASH stream
return ResolvedStream(
uuid=uuid,
url=data['videoDash']['S'],
stream_type=STREAM_DASH,
license_url='https://wv-keyos.licensekeyserver.com/',
auth=data_drm.get('auth'),
)
# Normal HLS stream
# Unprotected HLS stream
return ResolvedStream(
uuid=uuid,
url=data['video']['S'],