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,6 +361,8 @@ class ContentApi:
raise UnavailableException raise UnavailableException
if 'videoDash' in data: if 'videoDash' in data:
if 'drmKey' in data:
# DRM protected stream # DRM protected stream
# See https://docs.unified-streaming.com/documentation/drm/buydrm.html#setting-up-the-client # See https://docs.unified-streaming.com/documentation/drm/buydrm.html#setting-up-the-client
drm_key = data['drmKey']['S'] drm_key = data['drmKey']['S']
@ -369,6 +371,7 @@ class ContentApi:
response_drm = self._get_url(self.API_GOPLAY + '/video/xml/%s' % drm_key, authentication=self._auth.get_token()) response_drm = self._get_url(self.API_GOPLAY + '/video/xml/%s' % drm_key, authentication=self._auth.get_token())
data_drm = json.loads(response_drm) data_drm = json.loads(response_drm)
# DRM protected DASH stream
return ResolvedStream( return ResolvedStream(
uuid=uuid, uuid=uuid,
url=data['videoDash']['S'], url=data['videoDash']['S'],
@ -377,7 +380,14 @@ class ContentApi:
auth=data_drm.get('auth'), auth=data_drm.get('auth'),
) )
# Normal HLS stream # Unprotected DASH stream
return ResolvedStream(
uuid=uuid,
url=data['videoDash']['S'],
stream_type=STREAM_DASH,
)
# Unprotected HLS stream
return ResolvedStream( return ResolvedStream(
uuid=uuid, uuid=uuid,
url=data['video']['S'], url=data['video']['S'],