motion photo (#1071)
This commit is contained in:
commit
02ce6387df
3 changed files with 11 additions and 7 deletions
|
@ -49,7 +49,7 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>
|
|||
@override
|
||||
void initState() {
|
||||
_file = widget.file;
|
||||
_showLivePhotoToast();
|
||||
Future.microtask(() => _showHintForMotionPhotoPlay).ignore();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>
|
|||
return;
|
||||
}
|
||||
_isLoadingVideoPlayer = true;
|
||||
io.File? videoFile = _file.fileType == FileType.livePhoto
|
||||
final io.File? videoFile = _file.fileType == FileType.livePhoto
|
||||
? await _getLivePhotoVideo()
|
||||
: await _getMotionPhotoVideo();
|
||||
|
||||
|
@ -178,7 +178,7 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>
|
|||
});
|
||||
if (imageFile != null) {
|
||||
final motionPhoto = MotionPhotos(imageFile.path);
|
||||
final index = motionPhoto.getMotionVideoIndex();
|
||||
final index = await motionPhoto.getMotionVideoIndex();
|
||||
if (index != null) {
|
||||
if (widget.file.pubMagicMetadata?.mvi == null &&
|
||||
(widget.file.ownerID ?? 0) == Configuration.instance.getUserID()!) {
|
||||
|
@ -208,11 +208,15 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>
|
|||
});
|
||||
}
|
||||
|
||||
void _showLivePhotoToast() async {
|
||||
void _showHintForMotionPhotoPlay() async {
|
||||
if (widget.file.fileType != FileType.livePhoto ||
|
||||
widget.file.pubMagicMetadata?.mvi != null) {
|
||||
return;
|
||||
}
|
||||
final preferences = await SharedPreferences.getInstance();
|
||||
final int promptTillNow = preferences.getInt(livePhotoToastCounterKey) ?? 0;
|
||||
if (promptTillNow < maxLivePhotoToastCount && mounted) {
|
||||
showToast(context, S.of(context).pressAndHoldToPlayVideo);
|
||||
showShortToast(context, S.of(context).pressAndHoldToPlayVideo);
|
||||
preferences.setInt(livePhotoToastCounterKey, promptTillNow + 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ Future<MediaUploadData> _getMediaUploadDataFromAssetFile(ente.File file) async {
|
|||
if (io.Platform.isAndroid && asset.type == AssetType.image) {
|
||||
try {
|
||||
motionPhotoStartingIndex =
|
||||
MotionPhotos(sourceFile.path).getMotionVideoIndex()?.start;
|
||||
(await MotionPhotos(sourceFile.path).getMotionVideoIndex())?.start;
|
||||
} catch (e) {
|
||||
_logger.severe('error while detecthing motion photo start index', e);
|
||||
}
|
||||
|
|
|
@ -1186,7 +1186,7 @@ packages:
|
|||
description:
|
||||
path: "."
|
||||
ref: HEAD
|
||||
resolved-ref: ceeaff6e16bd9e3c98e7da2b1109dc04a93098b9
|
||||
resolved-ref: "989ea86e513755d9a8cf945e7522100fc2877639"
|
||||
url: "https://github.com/ente-io/motion_photo.git"
|
||||
source: git
|
||||
version: "0.0.1"
|
||||
|
|
Loading…
Add table
Reference in a new issue