immich icon indicating copy to clipboard operation
immich copied to clipboard

Mobile app throws an error when playing remote videos

Open LauriKem opened this issue 1 year ago • 6 comments

The bug

When trying to play a remote video on my Immich mobile application (Android 14, Pixel 8), the application throws an error.

In the UI side, when opening a video, the thumbnail, buffering icon and controls are shown for 1-2 seconds, after which the screen goes gray (with the controls still visible). No audio or video is played.

This happens only when playing videos which are located at the server, not when playing videos existing locally on the phone (even though they are backed up to the server, too).

This also happens only when using the app - by accessing the videos with the mobile browser (Chrome) the videos play OK. The videos play fine also on my computer (Firefox).

I have experienced this issue also with previous Immich server and app versions. The encoding of the video files has not helped with the issue.

From the application logs I can get these details:

  • Message:

FlutterError - Catch all

  • Details:

Exception: PlatformException(VideoError, Video player had error z2.r: Source error, null, null) Library: widgets library Context: building Widget-[<{ "id": 24355, "remoteId": "5efc8cef-5675-47c8-9f26-2c1d468f217a", "localId": "N/A", "checksum": "qgNk8YV8kZUO+NZlMrRNxz2cdTQ=", "ownerId": -7469303263042594039, "livePhotoVideoId": "N/A", "stackCount": "null", "stackParentId": "N/A", "fileCreatedAt": "2022-08-21 04:00:00.000", "fileModifiedAt": "2024-01-02 12:32:28.000", "updatedAt": "2024-01-02 13:20:53.200", "durationInSeconds": 23, "type": "AssetType.video", "fileName": "WhatsApp Video 2022-08-20 at 9.35.44 PM.mp4", "isFavorite": false, "isRemote": true, "storage": "AssetState.remote", "width": 640, "height": 352, "isArchived": false, "isTrashed": false, "isReadOnly": false, "isOffline": false, }>]

  • From:

#1 AsyncError.value (package:riverpod/src/common.dart:494:0) #2 VideoViewerPage.build (package:immich_mobile/modules/asset_viewer/views/video_viewer_page.dart:37:0)
#3 _ConsumerState.build (package:flutter_riverpod/src/consumer.dart:476:0) #4 StatefulElement.build (package:flutter/src/widgets/framework.dart:5592:0) #5 ConsumerStatefulElement.build (package:flutter_riverpod/src/consumer.dart:539:0) #6 HookElement.build (package:flutter_hooks/src/framework.dart:438:0) #7 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5480:0) #8 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:0) #9 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:0) #10 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2904:0) #11 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:989:0) #12 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:448:0) #13 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1386:0) #14 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1311:0) #15 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1169:0) #16 _invoke (dart:ui/hooks.dart:312:0) #17 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:399:0) #18 _drawFrame (dart:ui/hooks.dart:283:0)

The OS that Immich Server is running on

Ubuntu Server 22.04.2 LTS

Version of Immich Server

v1.101.0

Version of Immich Mobile App

v1.101.0

Platform with the issue

  • [ ] Server
  • [ ] Web
  • [X] Mobile

Your docker-compose.yml content

version: "3.8"

########################### SECRETS
secrets:
  postgres_immich_password:
    file: $SECRETSDIR/postgres_immich_password
  postgres_immich_user:
    file: $SECRETSDIR/postgres_immich_user
  postgres_immich_db:
    file: $SECRETSDIR/postgres_immich_db

########################### SERVICES
services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:v1.101.0
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    command: [ "start.sh", "immich" ]
    volumes:
      - /mnt/immich_share/library:/usr/src/app/upload/library
      - /mnt/immich_share/upload:/usr/src/app/upload/upload
      - /mnt/immich_share/profile:/usr/src/app/upload/profile
      - $APPDATADIR/immich_data/encoded-video:/usr/src/app/upload/encoded-video
      - $APPDATADIR/immich_data/thumbs:/usr/src/app/upload/thumbs
      - /etc/localtime:/etc/localtime:ro
    ports:
      - 2283:3001
    depends_on:
      - redis
      - database
    environment:
      - PUID=$PUID
      - PGID=$PGID
      - TZ=$TZ
      - DB_USERNAME=$IMMICH_POSTGRES_USER
      - DB_PASSWORD=$IMMICH_POSTGRES_PASSWORD
      - DB_DATABASE_NAME=$IMMICH_POSTGRES_DB
      - DB_HOSTNAME=immich_postgres
      - TYPESENSE_API_KEY=$IMMICH_TYPESENSE_API_KEY
      - REDIS_HOSTNAME=immich_redis
      - IMMICH_VERSION=v1.101.0
      - UPLOAD_LOCATION=/mnt/immich_share


  immich-microservices:
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:v1.101.0
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    command: [ "start.sh", "microservices" ]
    volumes:
      - /mnt/immich_share/library:/usr/src/app/upload/library
      - /mnt/immich_share/upload:/usr/src/app/upload/upload
      - /mnt/immich_share/profile:/usr/src/app/upload/profile
      - $APPDATADIR/immich_data/encoded-video:/usr/src/app/upload/encoded-video
      - $APPDATADIR/immich_data/thumbs:/usr/src/app/upload/thumbs
      - $APPDATADIR/immich_microservices:/usr/src/app/.reverse-geocoding-dump
      - /etc/localtime:/etc/localtime:ro
    depends_on:
      - redis
      - database
    environment:
      - PUID=$PUID
      - PGID=$PGID
      - TZ=$TZ
      - DB_USERNAME=$IMMICH_POSTGRES_USER
      - DB_PASSWORD=$IMMICH_POSTGRES_PASSWORD
      - DB_DATABASE_NAME=$IMMICH_POSTGRES_DB
      - DB_HOSTNAME=immich_postgres
      - TYPESENSE_API_KEY=$IMMICH_TYPESENSE_API_KEY
      - REDIS_HOSTNAME=immich_redis
      - IMMICH_VERSION=v1.101.0
      - UPLOAD_LOCATION=/mnt/immich_share

  immich-machine-learning:
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:v1.101.0
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    volumes:
      - /mnt/immich_share/library:/usr/src/app/upload/library
      - /mnt/immich_share/upload:/usr/src/app/upload/upload
      - /mnt/immich_share/profile:/usr/src/app/upload/profile
      - $APPDATADIR/immich_data/encoded-video:/usr/src/app/upload/encoded-video
      - $APPDATADIR/immich_data/thumbs:/usr/src/app/upload/thumbs
      - $APPDATADIR/immich_machine_learning:/cache
    environment:
      - PUID=$PUID
      - PGID=$PGID
      - TZ=$TZ
      - DB_USERNAME=$IMMICH_POSTGRES_USER
      - DB_PASSWORD=$IMMICH_POSTGRES_PASSWORD
      - DB_DATABASE_NAME=$IMMICH_POSTGRES_DB
      - DB_HOSTNAME=immich_postgres
      - TYPESENSE_API_KEY=$IMMICH_TYPESENSE_API_KEY
      - REDIS_HOSTNAME=immich_redis
      - IMMICH_VERSION=v1.101.0
      - UPLOAD_LOCATION=/mnt/immich_share

  redis:
    container_name: immich_redis
    image: registry.hub.docker.com/library/redis:6.2-alpine@sha256:51d6c56749a4243096327e3fb964a48ed92254357108449cb6e23999c37773c5
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    environment:
      - PUID=$PUID
      - PGID=$PGID
      - TZ=$TZ

  database:
    container_name: immich_postgres
    image: registry.hub.docker.com/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    environment:
      - PUID=$PUID
      - PGID=$PGID
      - TZ=$TZ
      - POSTGRES_PASSWORD=$IMMICH_POSTGRES_PASSWORD
      - POSTGRES_USER=$IMMICH_POSTGRES_USER
      - POSTGRES_DB=$IMMICH_POSTGRES_DB
      - DB_USERNAME=$IMMICH_POSTGRES_USER
      - DB_PASSWORD=$IMMICH_POSTGRES_PASSWORD
      - DB_DATABASE_NAME=$IMMICH_POSTGRES_DB
      - DB_HOSTNAME=immich_postgres
      - TYPESENSE_API_KEY=$IMMICH_TYPESENSE_API_KEY
      - REDIS_HOSTNAME=immich_redis
      - IMMICH_VERSION=v1.101.0
      - UPLOAD_LOCATION=/mnt/immich_share
    volumes:
      - $APPDATADIR/immich_db:/var/lib/postgresql/data

Your .env content

.env contains only the variables (like $PUID), otherwise all information and data is in the docker-compose above.

Reproduction steps

1. Open the Immich app on mobile
2. Open a video which is available only remotely (cloud icon)
3. Video does not play and the error above is thrown in the logs

Additional information

No response

LauriKem avatar Apr 12 '24 13:04 LauriKem

Are there any errors in the server logs?

bo0tzz avatar Apr 12 '24 13:04 bo0tzz

Nothing alarming visible in the containers' logs. I can try next week to increase the log level to debug if that would give any new insights. (Currently on default level)

LauriKem avatar Apr 13 '24 05:04 LauriKem

Is it possible to share the problematic video?

alextran1502 avatar Apr 15 '24 06:04 alextran1502

Hi, here's the video (different video but same behavior and bug on each video):

Video file:

https://github.com/immich-app/immich/assets/71082826/64908271-b392-43b0-a141-bd1f5a4043ad

I also took quick screencaptures of playing the video:

Mobile app (does not play):

https://github.com/immich-app/immich/assets/71082826/edbb2e08-6583-47ab-8fff-bfdf5b83b31b

Mobile web browser (plays OK):

https://github.com/immich-app/immich/assets/71082826/2187384b-3d23-4ee9-af27-6c0076888643

Details for this video error in app:

Exception: PlatformException(VideoError, Video player had error z2.r: Source error, null, null) Library: widgets library Context: building Widget-[<{ "id": 511, "remoteId": "418c8d8b-079e-4a76-8d2a-cb02bd509102", "localId": "N/A", "checksum": "/1uFmYVhhMPT7qRt3sWLlSFRm7Y=", "ownerId": -7469303263042594039, "livePhotoVideoId": "N/A", "stackCount": "null", "stackParentId": "N/A", "fileCreatedAt": "2020-07-05 17:05:45.000", "fileModifiedAt": "2024-01-02 19:22:21.000", "updatedAt": "2024-04-17 09:43:44.163", "durationInSeconds": 9, "type": "AssetType.video", "fileName": "4_5766872624361637683.mp4", "isFavorite": true, "isRemote": true, "storage": "AssetState.remote", "width": 720, "height": 1280, "isArchived": false, "isTrashed": false, "isReadOnly": false, "isOffline": false, }>]

Stack trace for this video error in app: #1 AsyncError.value (package:riverpod/src/common.dart:494:0) #2 VideoViewerPage.build (package:immich_mobile/modules/asset_viewer/views/video_viewer_page.dart:37:0) #3 _ConsumerState.build (package:flutter_riverpod/src/consumer.dart:476:0) #4 StatefulElement.build (package:flutter/src/widgets/framework.dart:5592:0) #5 ConsumerStatefulElement.build (package:flutter_riverpod/src/consumer.dart:539:0) #6 HookElement.build (package:flutter_hooks/src/framework.dart:438:0) #7 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5480:0) #8 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:0) #9 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:0) #10 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2904:0) #11 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:989:0) #12 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:448:0) #13 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1386:0) #14 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1311:0) #15 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1169:0) #16 _invoke (dart:ui/hooks.dart:312:0) #17 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:399:0) #18 _drawFrame (dart:ui/hooks.dart:283:0)

LauriKem avatar Apr 17 '24 06:04 LauriKem

I have exactly the same problem. I would be glad if the developers help solve it.

LexorELX avatar Apr 17 '24 12:04 LexorELX

I'm also facing the same issue with my videos, although for me the web interface does not display them either (on any device). I've tried running the transcode video job but I see the same.

App: 1.102.2 build.135 (Android 14 Pixel 8) Server: 1.102.3

The error log in my mobile app log is attached. details.txt stacktrace.txt

rwells1703 avatar Apr 23 '24 19:04 rwells1703

Are you using self-signed certificate by chance? I tested on both iOS and Android accessing the instance locally and the video can play normally

alextran1502 avatar Apr 26 '24 06:04 alextran1502

A very good point! I tested connection directly with IP address and the videos play now accordingly.

Interesting case, should we add a note of this into the mobile app FAQ (https://immich.app/docs/FAQ#mobile-app) for others facing this issue?

LauriKem avatar Apr 26 '24 11:04 LauriKem

Dupe: #5553

bo0tzz avatar Apr 26 '24 15:04 bo0tzz