Event media playback fails with 401 Unauthorized — credentials stripped from mediaPath

When attempting to play back recorded events, the Unity client fails with PlatformException(media open error, invalid or unsupported media) repeatedly.

Root cause identified: In lib/models/event.dart, the mediaPath getter has the credential injection commented out:

String get mediaPath {
  return '${mediaURL!.scheme}://'
      // '${Uri.encodeComponent(server.login)}'
      // ':'
      // '${Uri.encodeComponent(server.password)}'
      // '@'
      '${mediaURL!.host}'

This causes the Unity video player to request https://192.168.x.x:7001/media/request.php?id=N without authentication, resulting in a 401 Unauthorized from the server. The cookie header passed via setDataSource is apparently not sufficient when the session is not valid/present.

Fix: Uncomment those 4 lines so the URL becomes https://user:password@host:port/media/request.php?id=N — matching the pattern already used correctly in api_helpers.dart getLatestThumbnailForDeviceID.

To reproduce:

  1. Add a Bluecherry server with valid credentials
  2. Navigate to Events
  3. Try to play any recorded event
  4. Observe repeated media open error in logs and nothing plays

Environment:

  • Unity client built from unity-main (latest)
  • Bluecherry server 3.x on Ubuntu, nginx/1.24.0
  • Windows client
1 Like