TeamPiped / Piped

An alternative privacy-friendly YouTube frontend which is efficient by design.
https://piped.video
GNU Affero General Public License v3.0
8.19k stars 664 forks source link

Can't get videos to play on iOS #902

Open jk111 opened 2 years ago

jk111 commented 2 years ago

Official Instance

Describe the bug

Deployed piped today using docker-compose but I'm unable to play videos on iOS devices. I tested using Safari and Firefox. Pressing the play button over the video thumbnail does nothing.

I confirmed playback is working on my self hosted instance on a Mac using Firefox. It works both while internal to my home network as well as external (on hotspot).

Any ideas what I can check? The official hosted instance plays videos fine on my iOS device.

To Reproduce

  1. Browse to my piped self hosted URL.
  2. Select a video and try to play it.

Expected behavior

Expect the video to play.

Logs/Errors

Unknown at this time.

Browser, and OS with Version.

iOS 15.3.1 with latest Safari.

Additional context

No response

jk111 commented 2 years ago

I don't see any obvious errors in the logs of any of the containers.

Doing some more testing, videos play fine on my iPad running the same iOS version. Testing with a 2nd iPhone running the same iOS version results in the same video won't play issue.

ceptonit commented 2 years ago

I'm on iOS 15.4, using Safari. Tried on Firefox Focus as well, not that it matters since all browsers on iOS use the same safari engine (webkit).

Using the official instance, I seem to be able to play videos, but not when I choose a different resolution. Steps to reproduce:

  1. Go on any video.
  2. The video starts automatically and plays fine.
  3. While it's playing, select a different resolution.
  4. Video just loads forever and never plays.

This happens on any instance.

Maybe Apple changed something to their webkit on iOS 15.4?

jk111 commented 2 years ago

I re-deployed using caddy method and the video plays fine on iPhone now. Maybe I'm doing something wrong with the proxy configuration on Apache when using reverse proxy. Weird that it will play on all devices except iPhone though.

MrTastyBiscuits commented 2 years ago

I am experiencing the same issue that you described in your initial comment:

To Reproduce

  1. Browse to my piped self hosted URL.
  2. Select a video and try to play it.

Admittedly, I have deployed Piped through Docker in a way that is not described in the docs (I essentially used the Docker-Compose NGINX AIO way, and in front of it stands Traefik which is my usual reverse proxy). This could very well be the cause of my issue.

That said, I thought that the following errors, thrown by the NGINX and YTProxy containers, might help in understanding this issue.

They both throw it as soon as a page with a video is opened on my iPhone (iOS 15.4.1, Safari). The page loads, so do the comments and recommendations but the video itself does not and its duration is always "0:00".

This self-hosted instance works flawlessly on all my other devices. (And I do not have this issue on the official instance)

Thanks !

NGINX Container logs, click to expand ``` 2022/05/08 21:27:33 [error] 246#246: *2239 upstream prematurely closed connection while reading response header from upstream, client: 172.18.0.12, server: piped-proxy.[REDACTED DOMAIN/IP], request: "GET /api/manifest/hls_variant/expire/1652065420/ei/LDB4Yv2eNryL6dsPp7CpkA8/ip/[REDACTED DOMAIN/IP]/id/c378cb254ec34f91/source/youtube/requiressl/yes/playback_host/rr4---sn-nfpnnjvh-9ank.googlevideo.com/mh/io/mm/31%2C29/mn/sn-nfpnnjvh-9ank%2Csn-1gi7znek/ms/au%2Crdu/mv/m/mvi/4/pl/22/tx/24176215/txs/24176215%2C24176221/hfr/1/demuxed/1/tts_caps/1/maudio/1/initcwndbps/1896250/vprv/1/go/1/mt/1652043644/fvip/2/nvgoi/1/short_key/1/keepalive/yes/fexp/24001373%2C24007246/dover/11/itag/0/playlist_type/DVR/sparams/expire%2Cei%2Cip%2Cid%2Csource%2Crequiressl%2Ctx%2Ctxs%2Chfr%2Cdemuxed%2Ctts_caps%2Cmaudio%2Cvprv%2Cgo%2Citag%2Cplaylist_type/sig/AOq0QJ8wRAIgcnjn0PkSVgd1BZgbh2ioPr4HU-DBu-XMviPjQw7QeRkCICjvvN4HypEgNlRHGPPxo2ixvteWX28zo8O4vKeg1_IZ/lsparams/playback_host%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps/lsig/AG3C_xAwRQIhAOJywqQhwiFsWa8vj73ghC8FbolVB-j2XfPLn4x0zfNyAiAb8Dj1ACTPQl2hqYC2fJYKNOwbNkVII8E1qKOMYhT4yg%3D%3D/file/index.m3u8?host=manifest.googlevideo.com HTTP/1.1", upstream: "http://unix:/var/run/ytproxy/http-proxy.sock:/api/manifest/hls_variant/expire/1652065420/ei/LDB4Yv2eNryL6dsPp7CpkA8/ip/[REDACTED DOMAIN/IP]/id/c378cb254ec34f91/source/youtube/requiressl/yes/playback_host/rr4---sn-nfpnnjvh-9ank.googlevideo.com/mh/io/mm/31%2C29/mn/sn-nfpnnjvh-9ank%2Csn-1gi7znek/ms/au%2Crdu/mv/m/mvi/4/pl/22/tx/24176215/txs/24176215%2C24176221/hfr/1/demuxed/1/tts_caps/1/maudio/1/initcwndbps/1896250/vprv/1/go/1/mt/1652043644/fvip/2/nvgoi/1/short_key/1/keepalive/yes/fexp/24001373%2C24007246/dover/11/itag/0/playlist_type/DVR/sparams/expire%2Cei%2Cip%2Cid%2Csource%2Crequiressl%2Ctx%2Ctxs%2Chfr%2Cdemuxed%2Ctts_caps%2Cmaudio%2Cvprv%2Cgo%2Citag%2Cplaylist_type/sig/AOq0QJ8wRAIgcnjn0PkSVgd1BZgbh2ioPr4HU-DBu-XMviPjQw7QeRkCICjvvN4HypEgNlRHGPPxo2ixvteWX28zo8O4vKeg1_IZ/lsparams/playback_host%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps/lsig/AG3C_xAwRQIhAOJywqQ ```
YTProxy Container logs, click to expand ``` 2022-05-08T21:32:01.252381779Z 2022/05/08 21:32:01 Get "https://manifest.googlevideo.com/api/manifest/hls_variant/expire/1652065420/ei/LDB4Yv2eNryL6dsPp7CpkA8/ip/[REDACTED DOMAIN/IP]/id/c378cb254ec34f91/source/youtube/requiressl/yes/playback_host/rr4---sn-nfpnnjvh-9ank.googlevideo.com/mh/io/mm/31%2C29/mn/sn-nfpnnjvh-9ank%2Csn-1gi7znek/ms/au%2Crdu/mv/m/mvi/4/pl/22/tx/24176215/txs/24176215%2C24176221/hfr/1/demuxed/1/tts_caps/1/maudio/1/initcwndbps/1896250/vprv/1/go/1/mt/1652043644/fvip/2/nvgoi/1/short_key/1/keepalive/yes/fexp/24001373%2C24007246/dover/11/itag/0/playlist_type/DVR/sparams/expire%2Cei%2Cip%2Cid%2Csource%2Crequiressl%2Ctx%2Ctxs%2Chfr%2Cdemuxed%2Ctts_caps%2Cmaudio%2Cvprv%2Cgo%2Citag%2Cplaylist_type/sig/AOq0QJ8wRAIgcnjn0PkSVgd1BZgbh2ioPr4HU-DBu-XMviPjQw7QeRkCICjvvN4HypEgNlRHGPPxo2ixvteWX28zo8O4vKeg1_IZ/lsparams/playback_host%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps/lsig/AG3C_xAwRQIhAOJywqQhwiFsWa8vj73ghC8FbolVB-j2XfPLn4x0zfNyAiAb8Dj1ACTPQl2hqYC2fJYKNOwbNkVII8E1qKOMYhT4yg%3D%3D/file/index.m3u8": dial tcp 0.0.0.0:443: connect: connection refused 2022-05-08T21:32:01.252447650Z 2022/05/08 21:32:01 http: panic serving @: Get "https://manifest.googlevideo.com/api/manifest/hls_variant/expire/1652065420/ei/LDB4Yv2eNryL6dsPp7CpkA8/ip/[REDACTED DOMAIN/IP]/id/c378cb254ec34f91/source/youtube/requiressl/yes/playback_host/rr4---sn-nfpnnjvh-9ank.googlevideo.com/mh/io/mm/31%2C29/mn/sn-nfpnnjvh-9ank%2Csn-1gi7znek/ms/au%2Crdu/mv/m/mvi/4/pl/22/tx/24176215/txs/24176215%2C24176221/hfr/1/demuxed/1/tts_caps/1/maudio/1/initcwndbps/1896250/vprv/1/go/1/mt/1652043644/fvip/2/nvgoi/1/short_key/1/keepalive/yes/fexp/24001373%2C24007246/dover/11/itag/0/playlist_type/DVR/sparams/expire%2Cei%2Cip%2Cid%2Csource%2Crequiressl%2Ctx%2Ctxs%2Chfr%2Cdemuxed%2Ctts_caps%2Cmaudio%2Cvprv%2Cgo%2Citag%2Cplaylist_type/sig/AOq0QJ8wRAIgcnjn0PkSVgd1BZgbh2ioPr4HU-DBu-XMviPjQw7QeRkCICjvvN4HypEgNlRHGPPxo2ixvteWX28zo8O4vKeg1_IZ/lsparams/playback_host%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps/lsig/AG3C_xAwRQIhAOJywqQhwiFsWa8vj73ghC8FbolVB-j2XfPLn4x0zfNyAiAb8Dj1ACTPQl2hqYC2fJYKNOwbNkVII8E1qKOMYhT4yg%3D%3D/file/index.m3u8": dial tcp 0.0.0.0:443: connect: connection refused 2022-05-08T21:32:01.252462696Z goroutine 7875 [running]: 2022-05-08T21:32:01.252471106Z net/http.(*conn).serve.func1() 2022-05-08T21:32:01.252479137Z /usr/local/go/src/net/http/server.go:1825 +0xbf 2022-05-08T21:32:01.252487247Z panic({0x67e920, 0xc0000ba470}) 2022-05-08T21:32:01.252510106Z /usr/local/go/src/runtime/panic.go:844 +0x258 2022-05-08T21:32:01.252517937Z log.Panic({0xc0000e3a58?, 0xc0010c2400?, 0x6d338a?}) 2022-05-08T21:32:01.252526128Z /usr/local/go/src/log/log.go:385 +0x65 2022-05-08T21:32:01.252534179Z main.(*requesthandler).ServeHTTP(0xc00016e3a9, {0x750120, 0xc0008421c0}, 0xc0010c2300) 2022-05-08T21:32:01.252542082Z /app/main.go:152 +0x9df 2022-05-08T21:32:01.252549662Z net/http.serverHandler.ServeHTTP({0xc000c763f0?}, {0x750120, 0xc0008421c0}, 0xc0010c2300) 2022-05-08T21:32:01.252572973Z /usr/local/go/src/net/http/server.go:2916 +0x43b 2022-05-08T21:32:01.252581560Z net/http.(*conn).serve(0xc0006bc0a0, {0x750348, 0xc00010f7d0}) 2022-05-08T21:32:01.252589707Z /usr/local/go/src/net/http/server.go:1966 +0x5d7 2022-05-08T21:32:01.252597881Z created by net/http.(*Server).Serve 2022-05-08T21:32:01.252606112Z /usr/local/go/src/net/http/server.go:3071 +0x4db ```

Last minute addition, I remembered how to get the console output from Safari on iOS so here it is:

Debug Console of Safari on iOS 15.4.1, click to expand ``` https://piped-proxy.[REDACTED DOMAIN/IP]/api/manifest/hls_variant/expire/1652074827/ei/61R4YuP8MoS41wKexJnYAQ/ip/[REDACTED DOMAIN/IP]/id/c378cb254ec34f91/source/youtube/requiressl/yes/playback_host/rr4---sn-nfpnnjvh-9ank.googlevideo.com/mh/io/mm/31%2C29/mn/sn-nfpnnjvh-9ank%2Csn-1gi7znek/ms/au%2Crdu/mv/m/mvi/4/pl/22/tx/24067854/txs/24027699%2C24027700%2C24027701%2C24027702%2C24067854/hfr/1/demuxed/1/tts_caps/1/maudio/1/initcwndbps/1548750/vprv/1/go/1/mt/1652052768/fvip/2/nvgoi/1/short_key/1/keepalive/yes/fexp/24001373%2C24007246/dover/11/itag/0/playlist_type/DVR/sparams/expire%2Cei%2Cip%2Cid%2Csource%2Crequiressl%2Ctx%2Ctxs%2Chfr%2Cdemuxed%2Ctts_caps%2Cmaudio%2Cvprv%2Cgo%2Citag%2Cplaylist_type/sig/AOq0QJ8wRQIgacnEdm_-ivvoNGBSBMvax3Ep-6UFumnRBNYhdt7c574CIQCITQOr-71uZWst7z73bih8zbR53fx1aP-Wf2aH20IY1g%3D%3D/lsparams/playback_host%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps/lsig/AG3C_xAwRAIgLb8Eg1Nsas8A5swcM5tQ3WIng-j6jB012_4fwOoFkmoCIEm97dVFYNpF48WRu7KAyWSWKKaSoEmUkJ9a2BxKn-5-/file/index.m3u8?host=manifest.googlevideo.com [Error] Failed to load resource: the server responded with a status of 502 () (index.m3u8, line 0) [Error] Unhandled Promise Rejection: shaka.util.Error { "severity": 2, "category": 3, "code": 3016, "data": [ 4, null, "Unsupported source type" ], "handled": false } promiseEmptyOnRejected promiseReactionJob ```
danstewart commented 1 year ago

I'm having a similar issue but instead of a 502 it's a 429 (Too Many Requests) from Google.

The part that's confusing me is that piped doesn't try to load /api/manifest/hls_variant when on desktop or using the official instance on iOS so not sure why it's doing it on my hosted (single user) instance on iOS.

The error in the console is:

Failed to load resource: the server responded with a status of 429 (Too Many Requests)
[native code]:1 Unhandled Promise Rejection: shaka.util.Error {
  "severity": 2,
  "category": 3,
  "code": 3016,
  "data": [
    4,
    null,
    ""
  ],
  "handled": false
}

The issue is intermittent which I figure is Google unblocking my IP. Would be good if it was possible to just skip that request - though I can't find where it's being requested from.

If anyone has any suggestions for where to look I'm happy to look into this further.