From 1147a3b2bf2f967fa737c2767346dd63ab1dd1bc Mon Sep 17 00:00:00 2001
From: angelblue05 <angelblue.dev@gmail.com>
Date: Mon, 8 Oct 2018 21:12:59 -0500
Subject: [PATCH] Adjust playback

Allow direct play for http streams
---
 resources/lib/helper/playutils.py | 6 ++++--
 resources/lib/player.py           | 3 +--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/resources/lib/helper/playutils.py b/resources/lib/helper/playutils.py
index b1905e1e..9f362c38 100644
--- a/resources/lib/helper/playutils.py
+++ b/resources/lib/helper/playutils.py
@@ -183,7 +183,7 @@ class PlayUtils(object):
         if source['RequiresOpening']:
             source = self.live_stream(source)
 
-        if source['SupportsDirectPlay'] and (self.is_strm(source) or not settings('playFromStream.bool') and self.is_file_exists(source)):
+        if source.get('Protocol') == 'Http' or source['SupportsDirectPlay'] and (self.is_strm(source) or not settings('playFromStream.bool') and self.is_file_exists(source)):
 
             LOG.info("--[ direct play ]")
             self.direct_play(source)
@@ -304,7 +304,9 @@ class PlayUtils(object):
                 {
                     "Container": "m3u8",
                     "Type": "Video",
-                    "AudioCodec": "aac,mp3,ac3,opus,flac,vorbis"
+                    "AudioCodec": "aac,mp3,ac3,opus,flac,vorbis",
+                    "VideoCodec": "h264,mpeg4,mpeg2video",
+                    "MaxAudioChannels": "6"
                 },
                 {
                     "Container": "jpeg",
diff --git a/resources/lib/player.py b/resources/lib/player.py
index c313c6a2..f5a19790 100644
--- a/resources/lib/player.py
+++ b/resources/lib/player.py
@@ -79,8 +79,7 @@ class Player(xbmc.Player):
 
                 break
         else:
-            item = items[0]
-            items.pop(0)
+            item = items.pop(0)
 
         window('emby_play.json', items)