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

PE-4582: Audio Preview #1364

Merged
merged 24 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7a58b6f
initial work on new video player preview
kunstmusik Aug 31, 2023
b47e7d4
continuing work to deal with Chrome pause interrupting play call issue
kunstmusik Sep 1, 2023
f508786
experimenting with full screen implementation
kunstmusik Sep 1, 2023
03cf42d
added AspectRatio to fix view on fullscreen player
kunstmusik Sep 5, 2023
183d0bb
implement audio playing using just_audio package
kunstmusik Sep 5, 2023
a247051
Merge remote-tracking branch 'origin/dev' into PE-4338-video-preview
kunstmusik Sep 8, 2023
8db9d5d
working on audio player UI
kunstmusik Sep 11, 2023
760cc8f
added enableAudioPreview feature flag
kunstmusik Sep 11, 2023
862a3c3
adjust play button design per Figma
kunstmusik Sep 11, 2023
a932f39
adjust slider to more closely match Figma
kunstmusik Sep 11, 2023
00c576d
implement sliding volume control slider and mute functionality
kunstmusik Sep 12, 2023
48e67c3
only resume playing on seek if previously was playing when slider ini…
kunstmusik Sep 12, 2023
b1764a2
implemented music note visual for top preview area of audio player
kunstmusik Sep 12, 2023
278c153
implemented speed popup menu for desktop and mobile
kunstmusik Sep 14, 2023
dd30870
implemented file loading error path, also preserving state when tab s…
kunstmusik Sep 14, 2023
397932e
localization for couldNotLoadFile
kunstmusik Sep 14, 2023
e14d1eb
Merge remote-tracking branch 'origin' into PE-4582-audio-preview-in-app
kunstmusik Sep 14, 2023
8d581a2
make work with public pins on private drives
kunstmusik Sep 14, 2023
ef37dc4
removed dead commented code
kunstmusik Sep 18, 2023
edadd4e
Merge remote-tracking branch 'origin/dev' into PE-4582-audio-preview-…
kunstmusik Sep 22, 2023
a46b135
rename 1.0 speed option to 'Normal'
kunstmusik Sep 25, 2023
b481830
Merge pull request #1381 from ardriveapp/PE-4661-missing-normal-playb…
kunstmusik Sep 25, 2023
d90e7df
enable audio preview feature flag for staging and prod
kunstmusik Sep 27, 2023
b0753ab
Merge branch 'PE-4582-audio-preview-in-app' of github.com:ardriveapp/…
kunstmusik Sep 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion assets/config/dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"allowedDataItemSizeForTurbo": 500000,
"enableQuickSyncAuthoring": true,
"enableMultipleFileDownload": true,
"enableVideoPreview": false,
"enableVideoPreview": true,
"enableAudioPreview": true,
"stripePublishableKey": "pk_test_51JUAtwC8apPOWkDLh2FPZkQkiKZEkTo6wqgLCtQoClL6S4l2jlbbc5MgOdwOUdU9Tn93NNvqAGbu115lkJChMikG00XUfTmo2z",
"enablePins": true
}
1 change: 1 addition & 0 deletions assets/config/prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"enableQuickSyncAuthoring": true,
"enableMultipleFileDownload": true,
"enableVideoPreview": false,
"enableAudioPreview": false,
"stripePublishableKey": "pk_live_51JUAtwC8apPOWkDLMQqNF9sPpfneNSPnwX8YZ8y1FNDl6v94hZIwzgFSYl27bWE4Oos8CLquunUswKrKcaDhDO6m002Yj9AeKj",
"enablePins": true
}
1 change: 1 addition & 0 deletions assets/config/staging.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"enableQuickSyncAuthoring": true,
"enableMultipleFileDownload": true,
"enableVideoPreview": false,
"enableAudioPreview": false,
"stripePublishableKey": "pk_live_51JUAtwC8apPOWkDLMQqNF9sPpfneNSPnwX8YZ8y1FNDl6v94hZIwzgFSYl27bWE4Oos8CLquunUswKrKcaDhDO6m002Yj9AeKj",
"enablePins": true
}
42 changes: 41 additions & 1 deletion lib/blocs/fs_entry_preview/fs_entry_preview_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ class FsEntryPreviewCubit extends Cubit<FsEntryPreviewState> {
}

break;

case 'audio':
_previewAudio(
fileKey != null,
selectedItem,
previewUrl,
);
break;

case 'video':
_previewVideo(
fileKey != null,
Expand Down Expand Up @@ -175,6 +184,16 @@ class FsEntryPreviewCubit extends Cubit<FsEntryPreviewState> {
case 'image':
emitImagePreview(file, previewUrl);
break;

case 'audio':
_previewAudio(
(selectedItem as FileDataTableItem).pinnedDataOwnerAddress ==
null &&
drive.isPrivate,
selectedItem,
previewUrl,
);
break;
case 'video':
_previewVideo(
drive.isPrivate,
Expand All @@ -193,6 +212,23 @@ class FsEntryPreviewCubit extends Cubit<FsEntryPreviewState> {
}
}

void _previewAudio(
bool isPrivate, FileDataTableItem selectedItem, previewUrl) {
if (_configService.config.enableAudioPreview) {
if (isPrivate) {
emit(FsEntryPreviewUnavailable());
return;
}

emit(FsEntryPreviewAudio(
filename: selectedItem.name, previewUrl: previewUrl));

return;
}

emit(FsEntryPreviewUnavailable());
}

void _previewVideo(
bool isPrivate, FileDataTableItem selectedItem, previewUrl) {
if (_configService.config.enableVideoPreview) {
Expand All @@ -201,7 +237,8 @@ class FsEntryPreviewCubit extends Cubit<FsEntryPreviewState> {
return;
}

emit(FsEntryPreviewVideo(previewUrl: previewUrl));
emit(FsEntryPreviewVideo(
filename: selectedItem.name, previewUrl: previewUrl));

return;
}
Expand Down Expand Up @@ -298,6 +335,9 @@ class FsEntryPreviewCubit extends Cubit<FsEntryPreviewState> {
case 'image':
return supportedImageTypesInFilePreview
.any((element) => element.contains(fileExtension));
case 'audio':
return audioContentTypes
.any((element) => element.contains(fileExtension));
case 'video':
return videoContentTypes
.any((element) => element.contains(fileExtension));
Expand Down
14 changes: 9 additions & 5 deletions lib/blocs/fs_entry_preview/fs_entry_preview_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,25 @@ class FsEntryPreviewImage extends FsEntryPreviewSuccess {
}

class FsEntryPreviewAudio extends FsEntryPreviewSuccess {
const FsEntryPreviewAudio({
required String previewUrl,
}) : super(previewUrl: previewUrl);
final String filename;
const FsEntryPreviewAudio(
{required String previewUrl, required this.filename})
: super(previewUrl: previewUrl);

@override
List<Object> get props => [previewUrl];
List<Object> get props => [previewUrl, filename];
}

class FsEntryPreviewVideo extends FsEntryPreviewSuccess {
final String filename;

const FsEntryPreviewVideo({
required String previewUrl,
required this.filename,
}) : super(previewUrl: previewUrl);

@override
List<Object> get props => [previewUrl];
List<Object> get props => [previewUrl, filename];
}

class FsEntryPreviewMemory extends FsEntryPreviewSuccess {
Expand Down
14 changes: 14 additions & 0 deletions lib/dev_tools/app_dev_tools.dart
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,19 @@ class AppConfigWindowManagerState extends State<AppConfigWindowManager> {
type: ArDriveDevToolOptionType.bool,
);

ArDriveDevToolOption enableAudioPreviewOption = ArDriveDevToolOption(
name: 'enableAudioPreview',
value: settings.enableAudioPreview,
onChange: (value) {
setState(() {
configService.updateAppConfig(
settings.copyWith(enableAudioPreview: value),
);
});
},
type: ArDriveDevToolOptionType.bool,
);

ArDriveDevToolOption autoSyncIntervalInSecondsOption = ArDriveDevToolOption(
name: 'autoSyncIntervalInSeconds',
value: settings.autoSyncIntervalInSeconds,
Expand Down Expand Up @@ -323,6 +336,7 @@ class AppConfigWindowManagerState extends State<AppConfigWindowManager> {
enableQuickSyncAuthoringOption,
enableMultipleFileDownloadOption,
enableVideoPreviewOption,
enableAudioPreviewOption,
enableSeedPhreaseLogin,
allowedDataItemSizeForTurboOption,
defaultArweaveGatewayUrlOption,
Expand Down
Loading