Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
CastagnaIT committed Sep 20, 2023
1 parent c56dc6d commit 0ca742f
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion resources/lib/services/nfsession/msl/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,23 @@ def convert_to_dash(manifest):
root = _mpd_manifest_root(duration)
period = ET.SubElement(root, 'Period', start='PT0S', duration=duration)

# Netflix ADS appear to have a complex customization with the browser/player that cannot be completely
# implemented in to Kodi.
# There are a lot of complex things not easy to solve to have an appropriate ADS playback implementation:
# - Their player, once an ad is displayed, is removed from the video timeline in real time, there is no way to do
# a similar thing with this platform. But could be not a big problem.
# - Every time an ADS is played the website player send a MSL event like adStart/adProgress/...
# his data should be related to "adverts/adBreaks" json path from MSL manifest data, i think this is used
# by netflix to know when an ad is displayed for their business.
# Here its difficult know when a specific ads is played and then make a callback to send the MSL event,
# also we should not send multiple times these events because with kodi same ads may be played more times
# (refer to first point of this list).
# - Im not sure how to split the stream to inject the ads in the middle of stream, the correct way is split the
# main stream with more DASH periods, but the DASH SegmentBase needs to know the segments ranges (e.g. init).
# - Side effects with audio/subtitles track selection and addon features, ads have different audio/subtitles streams
# there will be a chaos with the addon features about language and track selection, since the addon is not able
# to understand when an ads is played or not.

has_video_drm_streams = manifest['video_tracks'][0].get('hasDrmStreams', False)
video_protection_info = _get_protection_info(manifest['video_tracks'][0]) if has_video_drm_streams else None

Expand Down Expand Up @@ -58,11 +75,15 @@ def convert_to_dash(manifest):
return xml.decode('utf-8').replace('\n', '').replace('\r', '').encode('utf-8')


def _add_period(root):



def _mpd_manifest_root(duration):
root = ET.Element('MPD')
root.attrib['xmlns'] = 'urn:mpeg:dash:schema:mpd:2011'
root.attrib['xmlns:cenc'] = 'urn:mpeg:cenc:2013'
root.attrib['mediaPresentationDuration'] = duration
#root.attrib['mediaPresentationDuration'] = duration
return root


Expand Down

0 comments on commit 0ca742f

Please sign in to comment.