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

Intermittent 'error playing video' issues #74

Closed
mattmcquinn opened this issue Apr 23, 2023 · 10 comments
Closed

Intermittent 'error playing video' issues #74

mattmcquinn opened this issue Apr 23, 2023 · 10 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@mattmcquinn
Copy link

Hi,
I have been having issues with playlet not being able to play some videos while playing others just fine.
The error message I get is the same as the error reported in issue #42

Error playing video
...
dbgmsg: got invalid pathname, load the next one
category: mediaplayer
errcode: 8
drmerrcode: 0

This is using my local instance and all videos work fine using Invidious in my browser.
I fixed my docker configuration and that fixed my image loading problem, but I still consistently get errors when playing some videos.

Here are some videos that are throwing the above error.

9mSmLI9imQk - youtube short
t5Qv86FZ2Xo - normal video
3aBPKONrAeU - normal video
2voCtSF5XTs - normal video
3inw26U-os4 - normal video

Here is the current api_state

{
    "app": {
        "git_commit_hash": "322232a02788e8c16bc8fdcff10b74e1685917ed",
        "id": "dev",
        "lib_git_commit_hash": "322232a02788e8c16bc8fdcff10b74e1685917ed",
        "lib_version": "0.9.0",
        "version": "0.9.0"
    },
    "device": {
        "display_aspect_ratio": "16x9",
        "display_mode": "720p",
        "display_size": {
            "h": 720,
            "w": 1280
        },
        "display_type": "HDTV",
        "graphics_platform": "opengl",
        "internet_status": true,
        "model_type": "TV",
        "os_version": {
            "build": "4323",
            "major": "11",
            "minor": "5",
            "revision": "0"
        },
        "ui_resolution": {
            "height": 1080,
            "name": "FHD",
            "width": 1920
        },
        "video_mode": "2160p60"
    },
    "invidious": {
        "auth_url": "http://myserver.local:3000/authorize_token?scopes=GET%3Afeed%2CGET%3Aplaylists%2CPOST%3Atokens%2Funregister%2CPOST%3Ahistory*&callback_url=http%3A%2F%2F192.168.69.172%3A8888%2Finvidious%2Ftoken_callback%3Fref%3Dhttp%3A%2F%2Fmyserver.local%3A3000&expire=1745340605",
        "instances": [
            "http://myserver.local:3000"
        ],
        "logged_in": true,
        "logged_in_instance": "http://myserver.local:3000",
        "logged_in_username": "username",
        "selected_instance": "http://myserver.local:3000"
    }
}

Thanks in advance for your help. Playlet has been really great to use!

@iBicha
Copy link
Owner

iBicha commented Apr 23, 2023

Thanks for reporting this issue. All these videos work for me on my local instance, so hard to diagnose.

To narrow things down

  • Since only some of the videos work fine, and only these are affected, we're going to assume it's not a config issue probably
  • Since the videos in question work in the browser, I would assume these are not geo-blocked

Perhaps this is hardware specific? (Specific hardware doesn't like specific video encoding?) that would be just a theory, but also unlikely

That error message is not well documented from what I can see. We will need to investigate further.

@iBicha iBicha added bug Something isn't working help wanted Extra attention is needed labels Apr 23, 2023
@mattmcquinn
Copy link
Author

Thanks for the quick reply and verifying the videos work on your machine.

If I wanted to dig into what might be the root cause, are you able to point me in the right direction?
I'm guessing I need to dig into Playlet logs to find more information or maybe a stacktrace.

I work as a developer and would like to contribute back to the project if possible.

Let me know if you think there is anything I can do to gather more information.

@iBicha
Copy link
Owner

iBicha commented Apr 26, 2023

I appreciate your interest in contributing!
I can give you a couple of pointers on debugging playlet

  • Start with Enabling Roku Developer Mode
  • Setup for development
  • In vs code, make sure BrightScript Language extension is installed
  • Press the play button, with the Playlet (dev) target selected. This will build Playlet it and run it on your TV with the debugger connected to vs code. You should also see Playlet logging all web requests it is making in vs code

Screen Shot 2023-04-26 at 8 27 39 AM

Now for some details on how playing a video works

  • When a video is launched, we make a list possible video streams of that video
  • The list is typically:
    • A DASH video
    • A DASH video with local set to true
    • A stream format
    • A stream format with local set to true

To explain what these mean:

  • DASH stands for Dynamic Adaptive Streaming over HTTP. It is simply an xml manifest that contains the links to the video in many resolutions. Then based on your internet speed, the best quality among then will be selected.
  • A format stream is simply a direct link to a video. We choose the best one, usually a 720p video most of the time.
  • local set to true, means that the video will not be streamed directly from Youtube servers, but instead will be proxied through Invidious. The video data will be downloaded by your instance, and Playlet will consume it.

The reason to use these variations is to have options to try from when streaming fails. (DASH sometimes fail, or streaming without proxy sometimes fail because it was geo-blocked, or because Youtube detected the discrepancy in IP addresses between the your instance and your TV).

When an error like the one you're seeing shows up, it usually means none of the streams worked. This is that part of the code where we detect an error and try the next stream available

Try to inspect the logs, see if something interesting comes up. I'll be happy to assist you if there's more info about this issue!

I hope this helps

Edit: A couple more debugging tools that are useful in some cases

  • http://ROKU_IP_ADDRESS:8888/debug/tmp will show what's under tmp:/
  • http://ROKU_IP_ADDRESS:8888/debug/cachefs will show what's under cachefs:/
    • This is where certain http requests are cached
  • More info about FileSystem here

@iBicha
Copy link
Owner

iBicha commented Apr 26, 2023

I realize now there's no easy way to gather logs fully without going into development mode. I've added an item to the roadmap to make collecting logs easier, kinda similar to how Plex does it

@mattmcquinn
Copy link
Author

Thanks for the detailed replies. I'll try to get setup this weekend.

@KyTiXo
Copy link

KyTiXo commented Sep 30, 2023

@mattmcquinn what did you change in your docker config to fix your image issue? I'm having a similar issue with thumbnails not loading on Roku but work in browser

I'm running it behind a Traefik proxy, so I'm sure something isn't configured right 😅

@mattmcquinn
Copy link
Author

mattmcquinn commented Oct 1, 2023

@mattmcquinn what did you change in your docker config to fix your image issue? I'm having a similar issue with thumbnails not loading on Roku but work in browser

I'm running it behind a Traefik proxy, so I'm sure something isn't configured right 😅

It has been a while since I have run invidious so I'm not exactly sure which change fixed it but I'll paste my docker-compose file here. If I had to guess it may have been my change under the ports section.

version: "3"
services:

  invidious:
    image: quay.io/invidious/invidious:latest
    # image: quay.io/invidious/invidious:latest-arm64 # ARM64/AArch64 devices
    restart: never
    ports:
      - "3000:3000"
    environment:
      # Please read the following file for a comprehensive list of all available
      # configuration options and their associated syntax:
      # https://github.com/iv-org/invidious/blob/master/config/config.example.yml
      INVIDIOUS_CONFIG: |
        db:
          dbname: invidious
          user: kemal
          password: kemal
          host: invidious-db
          port: 5432
        check_tables: true
        hmac_key: redacted
        external_port: 3000
        domain: redacted.local
        https_only: false
        # statistics_enabled: false
    healthcheck:
      test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/comments/jNQXAC9IVRw || exit 1
      interval: 30s
      timeout: 5s
      retries: 2
    logging:
      options:
        max-size: "1G"
        max-file: "4"
    depends_on:
      - invidious-db

  invidious-db:
    image: docker.io/library/postgres:14
    restart: never
    volumes:
      - postgresdata:/var/lib/postgresql/data
      - ./config/sql:/config/sql
      - ./docker/init-invidious-db.sh:/docker-entrypoint-initdb.d/init-invidious-db.sh
    environment:
      POSTGRES_DB: invidious
      POSTGRES_USER: kemal
      POSTGRES_PASSWORD: kemal
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]

volumes:
  postgresdata:

@iBicha
Copy link
Owner

iBicha commented Oct 2, 2023

Hi everyone,
There's a couple of overlapping issues making it hard to track and fix.

First, there's the issue with the thumbnails that do not show up

  • This is because the Invidious does not return a full image url if domain and external_port are not set
    • Example it would return /path/to/image.jpg instead of http://domain:port/path/to/image.jpg
    • This makes it work in the browser (since the browser adds the host portion automatically) but not in Roku

The second problem is the specific videos that do not work on Roku, but work on the web.

  • These seems to be specific to @mattmcquinn's instance for some reason (or it could be specific to his device/TV)

For the first problem, the latest version of Playlet attempts to prefix the url with the domain so that it works as is. I noticed that lots of people were digging into the right config to make it work, so I thought I might as well try to make it handled automatically.

For the second problem, although it is not solved, it's been a very long time since discovered. Since then, Invidious evolved, as well as Playlet, which was almost rewritten from the ground up.

So to keep things trackable, I'll close this ticket, and invite you to open a new issue for each problem separately, making sure to use the latest versions of Playlet/Invidious. Also, things that help investigating issues:

  • Share the Invidious instance used (or even better, share the state api content from http://ROKU_IP:8888/api/state)
  • You can also include logs (from http://ROKU_IP:8888/logs/app_logs.txt)
  • In the case of error that causes the app to crash, where it does not give you time to get the logs, you can open the app again, and get the logs for the previous run using http://ROKU_IP:8888/logs/app_logs_previous.txt

If there's a reason to keep this issue open, please let me know and I'll reopen.

Cheers!

@iBicha iBicha closed this as completed Oct 2, 2023
@xa4hf8
Copy link

xa4hf8 commented Nov 14, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants