Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Play on device does not work #107

Open
spacemanspiff2007 opened this issue Nov 21, 2024 · 4 comments
Open

Play on device does not work #107

spacemanspiff2007 opened this issue Nov 21, 2024 · 4 comments

Comments

@spacemanspiff2007
Copy link

Fresh docker install of 10.10.2 - only added an entry to bind to local interface 192.168.0.13
During startup this logs:

[2024-11-21 14:59:25.445 +01:00] [INF] [29] Jellyfin.Networking.Manager.NetworkManager: Defined LAN subnets: ["127.0.0.1/8", "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"]
[2024-11-21 14:59:25.445 +01:00] [INF] [29] Jellyfin.Networking.Manager.NetworkManager: Defined LAN exclusions: []
[2024-11-21 14:59:25.445 +01:00] [INF] [29] Jellyfin.Networking.Manager.NetworkManager: Used LAN subnets: ["127.0.0.1/8", "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"]
[2024-11-21 14:59:25.445 +01:00] [INF] [29] Jellyfin.Networking.Manager.NetworkManager: Filtered interface addresses: ["192.168.0.13"]
[2024-11-21 14:59:25.445 +01:00] [INF] [29] Jellyfin.Networking.Manager.NetworkManager: Bind Addresses ["192.168.0.13"]
[2024-11-21 14:59:25.445 +01:00] [INF] [29] Jellyfin.Networking.Manager.NetworkManager: Remote IP filter is "Allowlist"
[2024-11-21 14:59:25.445 +01:00] [INF] [29] Jellyfin.Networking.Manager.NetworkManager: Filtered subnets: []
[2024-11-21 14:59:40.706 +01:00] [INF] [29] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: "DLNA" "5.0.0.0"

I notice that the subnet for 192.168.0.0 is wrong, it should be 192.168.0.0/24.
Nontheless I can select and deselect my TV and it gets discovered

[2024-11-21 14:59:46.346 +01:00] [INF] [28] Jellyfin.Plugin.Dlna.Main.DlnaHost: DLNA Session created for "[LG] webOS TV " - "LG TV" using profile "LG Smart TV"

However when I click play this happens:

[2024-11-21 15:01:28.670 +01:00] [ERR] [62] Jellyfin.Api.Middleware.ExceptionMiddleware: Error processing request. URL "POST" "/Sessions/2dbbe260f9cc71d651b382fc128231f0/Playing".
System.Net.Http.HttpRequestException: Response status code does not indicate success: 500 (Internal Server Error).
   at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
   at Jellyfin.Plugin.Dlna.PlayTo.DlnaHttpClient.SendRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at Jellyfin.Plugin.Dlna.PlayTo.DlnaHttpClient.SendCommandAsync(String baseUrl, DeviceService service, String command, String postData, String header, CancellationToken cancellationToken)
   at Jellyfin.Plugin.Dlna.PlayTo.Device.SetAvTransport(String url, String header, String metaData, CancellationToken cancellationToken)
   at Jellyfin.Plugin.Dlna.PlayTo.PlayToController2.SetPlaylistIndex(Int32 index, CancellationToken cancellationToken)
   at Jellyfin.Plugin.Dlna.PlayTo.PlayToController2.PlayItems(IEnumerable`1 items, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Session.SessionManager.SendMessageToSession[T](SessionInfo session, SessionMessageType name, T data, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Session.SessionManager.SendPlayCommand(String controllingSessionId, String sessionId, PlayRequest command, CancellationToken cancellationToken)
   at Jellyfin.Api.Controllers.SessionController.Play(String sessionId, PlayCommand playCommand, Guid[] itemIds, Nullable`1 startPositionTicks, String mediaSourceId, Nullable`1 audioStreamIndex, Nullable`1 subtitleStreamIndex, Nullable`1 startIndex)
   at lambda_method2207(Closure, Object)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Jellyfin.Api.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager)
   at Jellyfin.Api.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager)
   at Jellyfin.Api.Middleware.IPBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager)
   at Jellyfin.Api.Middleware.LanFilteringMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Jellyfin.Api.Middleware.QueryStringDecodingMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.ReDoc.ReDocMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Jellyfin.Api.Middleware.RobotsRedirectionMiddleware.Invoke(HttpContext httpContext)
   at Jellyfin.Api.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
   at Jellyfin.Api.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context, IServerConfigurationManager serverConfigurationManager)
   at Jellyfin.Api.Middleware.ExceptionMiddleware.Invoke(HttpContext context)
@disgustipated
Copy link
Contributor

I'm able to reproduce this now. it only occurs when I have the following
all=https://mypublicuri

in the JF server settings Networking > Published Server URIs. If I remove that i can use play to from browser and cell app

@spacemanspiff2007
Copy link
Author

As I've written the issue arises even after a fresh install - the field is thus empty for me.

Image

@disgustipated
Copy link
Contributor

disgustipated commented Jan 14, 2025

it seems that the SetAVTransport call is trying to send back to the playback tracker as that looks to be the next call when this is working. This might be something with how the playback tracker is working in JF server I might be confused, that playback tracker is also a plugin and not the JF server.

working without Published Server URI set

[2025-01-14 05:23:04.595 -05:00] [INF] [11] Jellyfin.Plugin.Dlna.Main.DlnaHost: DLNA Session created for "goliath" - "LG TV" using profile "Goliath"
[2025-01-14 05:23:19.393 -05:00] [INF] [10] Jellyfin.Plugin.Dlna.Main.DlnaHost: "goliath" - SetAvTransport Uri: "http://MYINTERNALIP:8096/dlna/videos/47776c75-f6d2-a210-ab95-7017c41a3c34/stream.mkv?DeviceProfileId=a5b06aeabda0e413bd1b80c8b5c24e63&amp;DeviceId=72b18561-491f-884a-1d96-6a687e23dde4&amp;MediaSourceId=47776c75f6d2a210ab957017c41a3c34&amp;Static=true&amp;VideoCodec=h264&amp;AudioCodec=eac3&amp;AudioStreamIndex=1&amp;StartTimeTicks=23480000000&amp;SubtitleMethod=Encode&amp;Tag=448db38bcf6ee8f08a61dfa7a1b2235a&amp;dlnaheaders=true" DlnaHeaders: "DLNA.ORG_PN=MATROSKA;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=21D00000000000000000000000000000"
[2025-01-14 05:23:29.875 -05:00] [INF] [15] Jellyfin.Plugin.PlaybackReporting.EventMonitorEntryPoint: Adding playback tracker : 72b18561-491f-884a-1d96-6a687e23dde4-2e0e9075a13f4c73a6a4f3aa4abbd0ea-47776c75f6d2a210ab957017c41a3c34

not working with Published URI set to all=https://MYPUBLICURI

[2025-01-14 05:22:28.373 -05:00] [INF] [23] Jellyfin.Plugin.Dlna.Main.DlnaHost: "goliath" - SetAvTransport Uri: "https://MYPUBLICURI/dlna/videos/47776c75-f6d2-a210-ab95-7017c41a3c34/stream.mkv?DeviceProfileId=a5b06aeabda0e413bd1b80c8b5c24e63&amp;DeviceId=72b18561-491f-884a-1d96-6a687e23dde4&amp;MediaSourceId=47776c75f6d2a210ab957017c41a3c34&amp;Static=true&amp;VideoCodec=h264&amp;AudioCodec=eac3&amp;AudioStreamIndex=1&amp;StartTimeTicks=23480000000&amp;SubtitleMethod=Encode&amp;Tag=448db38bcf6ee8f08a61dfa7a1b2235a&amp;dlnaheaders=true" DlnaHeaders: "DLNA.ORG_PN=MATROSKA;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=21D00000000000000000000000000000"
[2025-01-14 05:22:28.485 -05:00] [ERR] [24] Jellyfin.Api.Middleware.ExceptionMiddleware: Error processing request. URL "POST" "/Sessions/426533c9fc6d30842eb3000c4921403b/Playing".
System.Net.Http.HttpRequestException: Response status code does not indicate success: 500 (Internal Server Error).
   at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
   at Jellyfin.Plugin.Dlna.PlayTo.DlnaHttpClient.SendRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at Jellyfin.Plugin.Dlna.PlayTo.DlnaHttpClient.SendCommandAsync(String baseUrl, DeviceService service, String command, String postData, String header, CancellationToken cancellationToken)
   at Jellyfin.Plugin.Dlna.PlayTo.Device.SetAvTransport(String url, String header, String metaData, CancellationToken cancellationToken)

This call does seem to route up through my nginx proxy, however the only things posted in the error log is

2025/01/14 05:22:58 [error] 6154#6154: *593225 connect() failed (111: Connection refused) while connecting to upstream, client: 6.13.0.198, server: MYPUBLICURI, request: "GET /ScheduledTasks?IsEnabled=true HTTP/2.0", upstream: "http://6.13.0.240:8096/ScheduledTasks?IsEnabled=true", host: "MYPUBLICURI"

i did also find this in the proxy server logs which looks to line up with the failed message above and where the 500 listed above is coming from

6.13.0.160 - - [14/Jan/2025:05:22:28 -0500] "POST /Sessions/426533c9fc6d30842eb3000c4921403b/Playing?ItemIds=47776c75f6d2a210ab957017c41a3c34&PlayCommand=PlayNow&StartPositionTicks=23480000000&MediaSourceId=47776c75f6d2a210ab957017c41a3c34&AudioStreamIndex=1&SubtitleStreamIndex=-1 HTTP/2.0" 500 25 "-" "Mozilla/5.0 (Linux; Android 15; CPH2583 Build/AP3A.240617.008; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/131.0.6778.260 Mobile Safari/537.36"

and the server is listening on that ip
[2025-01-14 05:22:58.382 -05:00] [INF] [1] Main: Kestrel is listening on "6.13.0.240"
and dlna is listening on that ip as well
[2025-01-14 05:22:58.449 -05:00] [INF] [1] Jellyfin.Plugin.Dlna.Main.DlnaHost: Registering publisher for "urn:schemas-upnp-org:device:MediaServer:1" on "6.13.0.240" with uri "http://6.13.0.240:8096/dlna/c8b0ef14-a211-4026-9ade-5e9136a28ab4/description.xml"

my nginx config for this subdomain looks fairly basic and lines up with what is on the JF documentation

NGINX proxy config

server {
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
server_name MYPUBLICURI;
include /config/nginx/ssl.conf;
include /config/nginx/proxy.conf;
access_log /config/log/nginx/MYPUBLICURI.access.log;
error_log /config/log/nginx/MYPUBLICURI.error.log;
access_log /config/log/nginx/access.log;
error_log /config/log/nginx/error.log;
client_max_body_size 20M;
set $jellyfin 6.13.0.240;
location = / {
return 302 https://$host/web/;
}
location / {
proxy_pass http://$jellyfin:8096;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Host $http_host;
proxy_buffering off;
}
location = /web/ {
proxy_pass http://$jellyfin:8096/web/index.html;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Host $http_host;
}
location /socket {
proxy_pass http://$jellyfin:8096;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Host $http_host;
}
}

I feel this might be something with how the call from the plugin to the Jellyfin.Api.Controllers.SessionController works. It looks like the required values in the post are there in my nginx log above as well as the additional parameters in the SessionController task for Playing. I'm not familiar with the sessionIds perhaps the session id is invalid? not sure.

interesting enough, I tried using the app called Macast to play to my laptop and it plays successfully with my published uri filled in, however the request still fails when trying to play to the LG tv.

maybe im down the wrong path here, but tracing this down through to the sessioncontroller, there is a call to getsessionid, which calls getsession, there is where there is a call to httpContext.GetNormalizedRemoteIP().ToString(), which appears to default to loopback if there is no remoteip specified. im wondering if there is something there where th elg tv is not accessible due to dns issues or something else which makes the request to playto device sen to loopback.

@disgustipated
Copy link
Contributor

Some further testing, i reproduced the error with debug logging turned on. i found the following immediately before the 500 error

[2025-01-14 11:32:03.036 -05:00] [DBG] [36] Jellyfin.Plugin.Dlna.Main.DlnaHost: "goliath" - SetAvTransport Uri: "https://mypublicuri/dlna/videos/47776c75-f6d2-a210-ab95-7017c41a3c34/stream.mkv?DeviceProfileId=a5b06aeabda0e413bd1b80c8b5c24e63&amp;DeviceId=72b18561-491f-884a-1d96-6a687e23dde4&amp;MediaSourceId=47776c75f6d2a210ab957017c41a3c34&amp;Static=true&amp;VideoCodec=h264&amp;AudioCodec=eac3&amp;AudioStreamIndex=1&amp;StartTimeTicks=23840000000&amp;Tag=448db38bcf6ee8f08a61dfa7a1b2235a&amp;dlnaheaders=true" DlnaHeaders: "DLNA.ORG_PN=MATROSKA;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=21D00000000000000000000000000000"

i was able to use that url and pull that file down with a browser successfully, i believe something is broken right after that communicating back the action of playing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants