diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index 4a860249..a26a8f30 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -1107,7 +1107,7 @@ def play_video(item, strm=False, force_direct=False, autoplay=False): # logger.error('Failed to resolve hostname, fallback to normal dns') from core import support # support.dbg() - if '|' not in mediaurl and item.referer != False and 'youtube' not in mediaurl: + if '|' not in mediaurl and item.referer != False and 'youtube' not in mediaurl and not 'mpd' in item.manifest and not 'hls' in item.manifest: mediaurl = mediaurl + '|' + urllib.urlencode(headers) # video information is obtained. @@ -1126,15 +1126,17 @@ def play_video(item, strm=False, force_direct=False, autoplay=False): xlistitem.setProperty("inputstream.adaptive.license_type", item.drm) xlistitem.setProperty("inputstream.adaptive.license_key", item.license) xlistitem.setMimeType('application/dash+xml') - xlistitem.setProperty('inputstream.adaptive.stream_headers', 'User-Agent='+httptools.get_user_agent()) + xlistitem.setProperty('inputstream.adaptive.stream_headers', urllib.urlencode(headers)) + xlistitem.setProperty('inputstream.adaptive.manifest_headers', urllib.urlencode(headers)) elif hls or item.manifest == 'hls':# or (mediaurl.split('|')[0].endswith('m3u8') and mediaurl.startswith('http')): if not install_inputstream(): return xlistitem.setProperty('inputstream' if PY3 else 'inputstreamaddon', 'inputstream.adaptive') xlistitem.setProperty('inputstream.adaptive.manifest_type', 'hls') xlistitem.setMimeType('application/x-mpegURL') - xlistitem.setProperty('inputstream.adaptive.stream_headers', 'User-Agent='+httptools.get_user_agent()) - xlistitem.setProperty('inputstream.adaptive.license_key', '|User-Agent='+httptools.get_user_agent() +'|') + xlistitem.setProperty('inputstream.adaptive.stream_headers', urllib.urlencode(headers)) + xlistitem.setProperty('inputstream.adaptive.manifest_headers', urllib.urlencode(headers)) + xlistitem.setProperty('inputstream.adaptive.license_key', '|' + urllib.urlencode(headers) +'|') if force_direct: item.play_from = 'window'