BaronGreenback 4 years ago
parent
commit
7ff52bf755

+ 4 - 17
Emby.Server.Implementations/ApplicationHost.cs

@@ -1201,25 +1201,12 @@ namespace Emby.Server.Implementations
         }
 
         /// <inheritdoc/>
-        public string GetInterfaceHttpApiUrl()
+        public string GetUrlForUseByHttpApi()
         {
-            // Published server ends with a /
-            if (!string.IsNullOrEmpty(PublishedServerUrl))
-            {
-                // Published server ends with a '/', so we need to remove it.
-                return PublishedServerUrl.Trim('/');
-            }
-
-            var bind = NetManager.GetInternalBindAddresses().FirstOrDefault() ?? new IPNetAddress(IPAddress.None);
+            var bind = NetManager.GetInternalBindAddresses().FirstOrDefault() ??
+                NetManager.GetAllBindInterfaces(true).FirstOrDefault();
 
-            string smart = NetManager.GetBindInterface(bind, out var port);
-            // If the smartAPI doesn't start with http then treat it as a host or ip.
-            if (smart.StartsWith("http", StringComparison.OrdinalIgnoreCase))
-            {
-                return smart.Trim('/');
-            }
-
-            return GetLocalApiUrl(smart.Trim('/'), null, port);
+            return GetLocalApiUrl(bind.Address.ToString(), Uri.UriSchemeHttp);
         }
 
         /// <inheritdoc/>

+ 1 - 1
Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs

@@ -1031,7 +1031,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
         {
             var stream = new MediaSourceInfo
             {
-                EncoderPath = _appHost.GetInterfaceHttpApiUrl() + "/LiveTv/LiveRecordings/" + info.Id + "/stream",
+                EncoderPath = _appHost.GetUrlForUseByHttpApi() + "/LiveTv/LiveRecordings/" + info.Id + "/stream",
                 EncoderProtocol = MediaProtocol.Http,
                 Path = info.Path,
                 Protocol = MediaProtocol.File,

+ 1 - 1
Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs

@@ -102,7 +102,7 @@ namespace Emby.Server.Implementations.LiveTv
                 // Dummy this up so that direct play checks can still run
                 if (string.IsNullOrEmpty(source.Path) && source.Protocol == MediaProtocol.Http)
                 {
-                    source.Path = _appHost.GetInterfaceHttpApiUrl();
+                    source.Path = _appHost.GetUrlForUseByHttpApi();
                 }
             }
 

+ 1 - 1
Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs

@@ -148,7 +148,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
             // OpenedMediaSource.Path = tempFile;
             // OpenedMediaSource.ReadAtNativeFramerate = true;
 
-            MediaSource.Path = _appHost.GetInterfaceHttpApiUrl() + "/LiveTv/LiveStreamFiles/" + UniqueId + "/stream.ts";
+            MediaSource.Path = _appHost.GetUrlForUseByHttpApi() + "/LiveTv/LiveStreamFiles/" + UniqueId + "/stream.ts";
             MediaSource.Protocol = MediaProtocol.Http;
             // OpenedMediaSource.SupportsDirectPlay = false;
             // OpenedMediaSource.SupportsDirectStream = true;

+ 1 - 1
Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs

@@ -97,7 +97,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
             // OpenedMediaSource.Path = tempFile;
             // OpenedMediaSource.ReadAtNativeFramerate = true;
 
-            MediaSource.Path = _appHost.GetInterfaceHttpApiUrl() + "/LiveTv/LiveStreamFiles/" + UniqueId + "/stream.ts";
+            MediaSource.Path = _appHost.GetUrlForUseByHttpApi() + "/LiveTv/LiveStreamFiles/" + UniqueId + "/stream.ts";
             MediaSource.Protocol = MediaProtocol.Http;
 
             // OpenedMediaSource.Path = TempFilePath;

+ 1 - 1
MediaBrowser.Controller/IServerApplicationHost.cs

@@ -91,7 +91,7 @@ namespace MediaBrowser.Controller
         /// Gets an URL that can be used to access the API over HTTP (not HTTPS).
         /// </summary>
         /// <returns>The API URL.</returns>
-        string GetInterfaceHttpApiUrl();
+        string GetUrlForUseByHttpApi();
 
         /// <summary>
         /// Gets a local (LAN) URL that can be used to access the API.