uploadVideo method
Future<void>
uploadVideo(
- BuildContext context,
- AppModel app,
- AccessRightsProvider accessRightsProvider,
- MediumAvailable feedbackFunction,
- FeedbackProgress? feedbackProgress,
override
Implementation
@override
Future<void> uploadVideo(
BuildContext context,
AppModel app,
AccessRightsProvider accessRightsProvider,
MediumAvailable feedbackFunction,
FeedbackProgress? feedbackProgress) async {
try {
var ownerId = AccessBloc.memberId(context);
if (ownerId == null) {
throw Exception("Expecting to have a member logged in to take a photo");
}
var memberMediumDocumentID = newRandomKey();
var result = await FilePicker.platform
.pickFiles(type: FileType.video, allowMultiple: false);
if (result == null) {
feedbackFunction(null);
return;
}
var aFile = result.files[0];
var path = aFile.path;
if (path == null) {
feedbackFunction(null);
return;
}
var memberMediumModel = await accessRightsProvider()
.getMediumHelper(app, ownerId)
.createThumbnailUploadVideoFile(memberMediumDocumentID, path,
feedbackProgress: feedbackProgress);
feedbackFunction(memberMediumModel);
} catch (error) {
print('Error trying to uploadVideo: $error');
feedbackFunction(null);
}
}