Skip to content

Commit

Permalink
feat: Use mediaPath
Browse files Browse the repository at this point in the history
  • Loading branch information
bdlukaa committed Sep 28, 2024
1 parent 3d343e6 commit ed8e8f7
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
13 changes: 13 additions & 0 deletions lib/models/event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,19 @@ class Event {
}
}

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

Event copyWith({
Server? server,
int? id,
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/events_timeline/events_playback.dart
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ extension DevicesMapExtension on MapEntry<Device, Iterable<Event>> {
downloads.getDownloadedPathForEvent(event.id),
windows: isDesktopPlatform && Platform.isWindows,
).toString()
: event.mediaURL!.toString();
: event.mediaPath;

return TimelineEvent(
startTime: event.published,
Expand Down
6 changes: 3 additions & 3 deletions lib/screens/players/event_player_desktop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ class _EventPlayerDesktopState extends State<EventPlayerDesktop> {
windows: Platform.isWindows,
).toString();
}
return event.mediaURL.toString();
return event.mediaPath;
}()
: event.mediaURL.toString();
: event.mediaPath;

if (mediaUrl != videoController.dataSource) {
debugPrint(
Expand Down Expand Up @@ -193,7 +193,7 @@ class _EventPlayerDesktopState extends State<EventPlayerDesktop> {
Expanded(
child: InteractiveViewer(
child: UnityVideoView(
heroTag: currentEvent.mediaURL,
heroTag: currentEvent.mediaPath,
player: videoController,
fit: fit,
paneBuilder: (context, player) {
Expand Down
4 changes: 2 additions & 2 deletions lib/screens/players/event_player_mobile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class __EventPlayerMobileState extends State<_EventPlayerMobile> {
downloads.getDownloadedPathForEvent(widget.event.id),
windows: Platform.isWindows,
).toString()
: widget.event.mediaURL.toString();
: widget.event.mediaPath;

debugPrint(mediaUrl);
if (videoController.dataSource != mediaUrl) {
Expand Down Expand Up @@ -120,7 +120,7 @@ class __EventPlayerMobileState extends State<_EventPlayerMobile> {
Expanded(
child: SafeArea(
child: UnityVideoView(
heroTag: widget.event.mediaURL,
heroTag: widget.event.mediaPath,
player: videoController,
fit: settings.kVideoFit.value,
videoBuilder: (context, video) {
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/video_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class UnityPlayers with ChangeNotifier {
);
},
)
..setDataSource(event.mediaURL!.toString())
..setDataSource(event.mediaPath.toString())
..setVolume(1.0)
..setSpeed(1.0);

Expand Down

0 comments on commit ed8e8f7

Please sign in to comment.