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:
- Add a Bluecherry server with valid credentials
- Navigate to Events
- Try to play any recorded event
- Observe repeated
media open errorin logs and nothing plays
Environment:
- Unity client built from
unity-main(latest) - Bluecherry server 3.x on Ubuntu, nginx/1.24.0
- Windows client