diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml
index 07d33436..4ab2fe0b 100644
--- a/resources/language/English/strings.xml
+++ b/resources/language/English/strings.xml
@@ -354,6 +354,6 @@
Backup folder
Select content type to repair
Failed to retrieve latest updates using fast sync, using full sync.
- Important, cleanonupdate was removed in your advanced settings to prevent conflict with Emby for Kodi. Kodi will restart now.
-
+ Limit video resolution to screen resolution
+ Important, cleanonupdate was removed in your advanced settings to prevent conflict with Emby for Kodi. Kodi will restart now.
\ No newline at end of file
diff --git a/resources/language/German/strings.xml b/resources/language/German/strings.xml
index fa92956d..7a27863b 100644
--- a/resources/language/German/strings.xml
+++ b/resources/language/German/strings.xml
@@ -347,4 +347,6 @@
Alle zwischengespeicherten Bilder entfernen?
Alle Emby Addon-Einstellungen zurücksetzen?
Zurücksetzen der Datenbank abgeschlossen, Kodi wird nun neustarten um die Änderungen anzuwenden.
+ Video Auflösung auf Bildschirm Auflösung limitieren
+
diff --git a/resources/lib/playutils.py b/resources/lib/playutils.py
index 3cbd411d..9fac6655 100644
--- a/resources/lib/playutils.py
+++ b/resources/lib/playutils.py
@@ -168,6 +168,11 @@ class PlayUtils():
log.info("Can't direct play, server doesn't allow/support it.")
return False
+ # Verify screen resolution
+ if self.resolutionConflict():
+ log.info("Can't direct play, resolution limit is enabled")
+ return False
+
location = self.item['LocationType']
if location == "FileSystem":
# Verify the path
@@ -271,6 +276,11 @@ class PlayUtils():
log.info("The network speed is insufficient to direct stream file.")
return False
+ # Verify screen resolution
+ if self.resolutionConflict():
+ log.info("Can't direct stream, resolution limit is enabled")
+ return False
+
return True
def directStream(self):
@@ -331,6 +341,11 @@ class PlayUtils():
if transcodeHi10P == "true":
playurl = "%s&MaxVideoBitDepth=8" % playurl
+ # Adjust video resolution
+ if self.resolutionConflict():
+ screenRes = self.getScreenResolution()
+ playurl = "%s&maxWidth=%s&maxHeight=%s" % (playurl, screenRes['width'], screenRes['height'])
+
user_token = downloadutils.DownloadUtils().get_token()
playurl += "&api_key=" + str(user_token)
@@ -659,4 +674,22 @@ class PlayUtils():
"DidlMode": ""
}
]
- }
\ No newline at end of file
+ }
+
+ def resolutionConflict(self):
+ if settings('limitResolution') == "true":
+ screenRes = self.getScreenResolution()
+ videoRes = self.getVideoResolution()
+ return videoRes['width'] > screenRes['width'] or videoRes['height'] > screenRes['height']
+ else:
+ return False
+
+ def getScreenResolution(self):
+ wind = xbmcgui.Window()
+ return {'width' : wind.getWidth(),
+ 'height' : wind.getHeight()}
+
+ def getVideoResolution(self):
+ return {'width' : self.item['MediaStreams'][0]['Width'],
+ 'height' : self.item['MediaStreams'][0]['Height']}
+
diff --git a/resources/settings.xml b/resources/settings.xml
index 1a554199..24a1951b 100644
--- a/resources/settings.xml
+++ b/resources/settings.xml
@@ -54,7 +54,8 @@
-
+
+