161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
461847f8eSopenharmony_ci * you may not use this file except in compliance with the License.
561847f8eSopenharmony_ci * You may obtain a copy of the License at
661847f8eSopenharmony_ci *
761847f8eSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
861847f8eSopenharmony_ci *
961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and
1361847f8eSopenharmony_ci * limitations under the License.
1461847f8eSopenharmony_ci */
1561847f8eSopenharmony_ci
1661847f8eSopenharmony_ci/**
1761847f8eSopenharmony_ci * @file A component which support applications to show moving photo data 
1861847f8eSopenharmony_ci * @kit MediaLibraryKit
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ciimport photoAccessHelper from './@ohos.file.photoAccessHelper';
2261847f8eSopenharmony_ci
2361847f8eSopenharmony_ci/**
2461847f8eSopenharmony_ci * Defines the moving photo view options.
2561847f8eSopenharmony_ci *
2661847f8eSopenharmony_ci * @interface MovingPhotoViewOptions
2761847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
2861847f8eSopenharmony_ci * @crossplatform
2961847f8eSopenharmony_ci * @atomicservice
3061847f8eSopenharmony_ci * @since 12
3161847f8eSopenharmony_ci */
3261847f8eSopenharmony_cideclare interface MovingPhotoViewOptions {
3361847f8eSopenharmony_ci    /**
3461847f8eSopenharmony_ci     * moving photo data.
3561847f8eSopenharmony_ci     *
3661847f8eSopenharmony_ci     * @type { photoAccessHelper.MovingPhoto }
3761847f8eSopenharmony_ci     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
3861847f8eSopenharmony_ci     * @crossplatform
3961847f8eSopenharmony_ci     * @atomicservice
4061847f8eSopenharmony_ci     * @since 12
4161847f8eSopenharmony_ci     */
4261847f8eSopenharmony_ci    movingPhoto: photoAccessHelper.MovingPhoto;
4361847f8eSopenharmony_ci    /**
4461847f8eSopenharmony_ci     * controller of MovingPhotoView.
4561847f8eSopenharmony_ci     *
4661847f8eSopenharmony_ci     * @type { ?MovingPhotoViewController }
4761847f8eSopenharmony_ci     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
4861847f8eSopenharmony_ci     * @crossplatform
4961847f8eSopenharmony_ci     * @atomicservice
5061847f8eSopenharmony_ci     * @since 12
5161847f8eSopenharmony_ci     */
5261847f8eSopenharmony_ci    controller?: MovingPhotoViewController;
5361847f8eSopenharmony_ci    /**
5461847f8eSopenharmony_ci     * image ai options of MovingPhotoView.
5561847f8eSopenharmony_ci     *
5661847f8eSopenharmony_ci     * @type { ?ImageAIOptions }
5761847f8eSopenharmony_ci     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
5861847f8eSopenharmony_ci     * @crossplatform
5961847f8eSopenharmony_ci     * @atomicservice
6061847f8eSopenharmony_ci     * @uicomponent
6161847f8eSopenharmony_ci     * @since 14
6261847f8eSopenharmony_ci     */
6361847f8eSopenharmony_ci    imageAIOptions?: ImageAIOptions;
6461847f8eSopenharmony_ci}
6561847f8eSopenharmony_ci/**
6661847f8eSopenharmony_ci * Defines the moving photo view interface.
6761847f8eSopenharmony_ci *
6861847f8eSopenharmony_ci * @interface MovingPhotoViewInterface
6961847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
7061847f8eSopenharmony_ci * @crossplatform
7161847f8eSopenharmony_ci * @atomicservice
7261847f8eSopenharmony_ci * @since 12
7361847f8eSopenharmony_ci */
7461847f8eSopenharmony_ciinterface MovingPhotoViewInterface {
7561847f8eSopenharmony_ci    /**
7661847f8eSopenharmony_ci     * Set the options.
7761847f8eSopenharmony_ci     *
7861847f8eSopenharmony_ci     * @param { MovingPhotoViewOptions } options
7961847f8eSopenharmony_ci     * @returns { MovingPhotoViewAttribute }
8061847f8eSopenharmony_ci     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
8161847f8eSopenharmony_ci     * @crossplatform
8261847f8eSopenharmony_ci     * @atomicservice
8361847f8eSopenharmony_ci     * @since 12
8461847f8eSopenharmony_ci     */
8561847f8eSopenharmony_ci    (options: MovingPhotoViewOptions): MovingPhotoViewAttribute;
8661847f8eSopenharmony_ci}
8761847f8eSopenharmony_ci
8861847f8eSopenharmony_ci/**
8961847f8eSopenharmony_ci * function that moving photo view media events callback.
9061847f8eSopenharmony_ci *
9161847f8eSopenharmony_ci * @typedef { function } MovingPhotoViewEventCallback
9261847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
9361847f8eSopenharmony_ci * @crossplatform
9461847f8eSopenharmony_ci * @atomicservice
9561847f8eSopenharmony_ci * @since 12
9661847f8eSopenharmony_ci */
9761847f8eSopenharmony_cideclare type MovingPhotoViewEventCallback = () => void;
9861847f8eSopenharmony_ci
9961847f8eSopenharmony_ci/**
10061847f8eSopenharmony_ci * Defines the moving photo view attribute functions.
10161847f8eSopenharmony_ci *
10261847f8eSopenharmony_ci * @extends CommonMethod<MovingPhotoViewAttribute>
10361847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
10461847f8eSopenharmony_ci * @crossplatform
10561847f8eSopenharmony_ci * @atomicservice
10661847f8eSopenharmony_ci * @since 12
10761847f8eSopenharmony_ci */
10861847f8eSopenharmony_cideclare class MovingPhotoViewAttribute extends CommonMethod<MovingPhotoViewAttribute> {
10961847f8eSopenharmony_ci    /**
11061847f8eSopenharmony_ci     * Called when judging whether the video is muted.
11161847f8eSopenharmony_ci     *
11261847f8eSopenharmony_ci     * @param { boolean } isMuted
11361847f8eSopenharmony_ci     * @returns { MovingPhotoViewAttribute }
11461847f8eSopenharmony_ci     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
11561847f8eSopenharmony_ci     * @crossplatform
11661847f8eSopenharmony_ci     * @atomicservice
11761847f8eSopenharmony_ci     * @since 12
11861847f8eSopenharmony_ci     */
11961847f8eSopenharmony_ci    muted(isMuted: boolean): MovingPhotoViewAttribute;
12061847f8eSopenharmony_ci	/**
12161847f8eSopenharmony_ci     * Called when determining the zoom type of the view.
12261847f8eSopenharmony_ci     *
12361847f8eSopenharmony_ci     * @param { ImageFit } value
12461847f8eSopenharmony_ci     * @returns { MovingPhotoViewAttribute }
12561847f8eSopenharmony_ci     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
12661847f8eSopenharmony_ci     * @crossplatform
12761847f8eSopenharmony_ci     * @atomicservice
12861847f8eSopenharmony_ci     * @since 12
12961847f8eSopenharmony_ci     */
13061847f8eSopenharmony_ci    objectFit(value: ImageFit): MovingPhotoViewAttribute;
13161847f8eSopenharmony_ci    /**
13261847f8eSopenharmony_ci     * Called when the image load completed.
13361847f8eSopenharmony_ci     *
13461847f8eSopenharmony_ci     * @param { MovingPhotoViewEventCallback } callback
13561847f8eSopenharmony_ci     * @returns { MovingPhotoViewAttribute }
13661847f8eSopenharmony_ci     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
13761847f8eSopenharmony_ci     * @crossplatform
13861847f8eSopenharmony_ci     * @atomicservice
13961847f8eSopenharmony_ci     * @since 13
14061847f8eSopenharmony_ci     */
14161847f8eSopenharmony_ci    onComplete(callback: MovingPhotoViewEventCallback): MovingPhotoViewAttribute;
14261847f8eSopenharmony_ci    /**
14361847f8eSopenharmony_ci     * Called when the video is played.
14461847f8eSopenharmony_ci     *
14561847f8eSopenharmony_ci     * @param { MovingPhotoViewEventCallback } callback
14661847f8eSopenharmony_ci     * @returns { MovingPhotoViewAttribute }
14761847f8eSopenharmony_ci     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
14861847f8eSopenharmony_ci     * @crossplatform
14961847f8eSopenharmony_ci     * @atomicservice
15061847f8eSopenharmony_ci     * @since 12
15161847f8eSopenharmony_ci     */
15261847f8eSopenharmony_ci    onStart(callback: MovingPhotoViewEventCallback): MovingPhotoViewAttribute;
15361847f8eSopenharmony_ci    /**
15461847f8eSopenharmony_ci     * Called when the video playback stopped.
15561847f8eSopenharmony_ci     *
15661847f8eSopenharmony_ci     * @param { MovingPhotoViewEventCallback } callback
15761847f8eSopenharmony_ci     * @returns { MovingPhotoViewAttribute }
15861847f8eSopenharmony_ci     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
15961847f8eSopenharmony_ci     * @crossplatform
16061847f8eSopenharmony_ci     * @atomicservice
16161847f8eSopenharmony_ci     * @since 12
16261847f8eSopenharmony_ci     */
16361847f8eSopenharmony_ci    onStop(callback: MovingPhotoViewEventCallback): MovingPhotoViewAttribute;
16461847f8eSopenharmony_ci    /**
16561847f8eSopenharmony_ci     * Called when the video playback paused.
16661847f8eSopenharmony_ci     *
16761847f8eSopenharmony_ci     * @param { MovingPhotoViewEventCallback } callback
16861847f8eSopenharmony_ci     * @returns { MovingPhotoViewAttribute }
16961847f8eSopenharmony_ci     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
17061847f8eSopenharmony_ci     * @crossplatform
17161847f8eSopenharmony_ci     * @atomicservice
17261847f8eSopenharmony_ci     * @since 12
17361847f8eSopenharmony_ci     */
17461847f8eSopenharmony_ci    onPause(callback: MovingPhotoViewEventCallback): MovingPhotoViewAttribute;
17561847f8eSopenharmony_ci    /**
17661847f8eSopenharmony_ci     * Called when the video playback ends.
17761847f8eSopenharmony_ci     *
17861847f8eSopenharmony_ci     * @param { MovingPhotoViewEventCallback } callback
17961847f8eSopenharmony_ci     * @returns { MovingPhotoViewAttribute }
18061847f8eSopenharmony_ci     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
18161847f8eSopenharmony_ci     * @crossplatform
18261847f8eSopenharmony_ci     * @atomicservice
18361847f8eSopenharmony_ci     * @since 12
18461847f8eSopenharmony_ci     */
18561847f8eSopenharmony_ci    onFinish(callback: MovingPhotoViewEventCallback): MovingPhotoViewAttribute;
18661847f8eSopenharmony_ci    /**
18761847f8eSopenharmony_ci     * Called when playback fails.
18861847f8eSopenharmony_ci     *
18961847f8eSopenharmony_ci     * @param { MovingPhotoViewEventCallback } callback
19061847f8eSopenharmony_ci     * @returns { MovingPhotoViewAttribute }
19161847f8eSopenharmony_ci     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
19261847f8eSopenharmony_ci     * @crossplatform
19361847f8eSopenharmony_ci     * @atomicservice
19461847f8eSopenharmony_ci     * @since 12
19561847f8eSopenharmony_ci     */
19661847f8eSopenharmony_ci    onError(callback: MovingPhotoViewEventCallback): MovingPhotoViewAttribute;
19761847f8eSopenharmony_ci    /**
19861847f8eSopenharmony_ci     * Sets automatic play period, If not set, the moving photo plays in the full video duration.
19961847f8eSopenharmony_ci     * If set, the moving photo plays in the automatic play period.
20061847f8eSopenharmony_ci     *
20161847f8eSopenharmony_ci     * @param { number } startTime video plays start time
20261847f8eSopenharmony_ci     * @param { number } endTime   video plays end time
20361847f8eSopenharmony_ci     * @returns { MovingPhotoViewAttribute }
20461847f8eSopenharmony_ci     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
20561847f8eSopenharmony_ci     * @crossplatform
20661847f8eSopenharmony_ci     * @atomicservice
20761847f8eSopenharmony_ci     * @since 13
20861847f8eSopenharmony_ci     */
20961847f8eSopenharmony_ci    autoPlayPeriod(startTime: number, endTime: number): MovingPhotoViewAttribute;
21061847f8eSopenharmony_ci    /**
21161847f8eSopenharmony_ci     * Sets whether to allow automatic play. If the value is true, the moving photo starts 
21261847f8eSopenharmony_ci     * automatic after the resource is loaded.
21361847f8eSopenharmony_ci     *
21461847f8eSopenharmony_ci     * @param { boolean } isAutoPlay  Whether to automatic play
21561847f8eSopenharmony_ci     * @returns { MovingPhotoViewAttribute }
21661847f8eSopenharmony_ci     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
21761847f8eSopenharmony_ci     * @crossplatform
21861847f8eSopenharmony_ci     * @atomicservice
21961847f8eSopenharmony_ci     * @since 13
22061847f8eSopenharmony_ci     */
22161847f8eSopenharmony_ci    autoPlay(isAutoPlay: boolean): MovingPhotoViewAttribute;
22261847f8eSopenharmony_ci    /**
22361847f8eSopenharmony_ci     * Sets whether to allow repeat play. If the value is true, the moving photo plays 
22461847f8eSopenharmony_ci     * repeat after the resource is loaded.
22561847f8eSopenharmony_ci     *
22661847f8eSopenharmony_ci     * @param { boolean } isRepeatPlay  Whether to repeat play
22761847f8eSopenharmony_ci     * @returns { MovingPhotoViewAttribute }
22861847f8eSopenharmony_ci     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
22961847f8eSopenharmony_ci     * @crossplatform
23061847f8eSopenharmony_ci     * @atomicservice
23161847f8eSopenharmony_ci     * @since 13
23261847f8eSopenharmony_ci     */
23361847f8eSopenharmony_ci    repeatPlay(isRepeatPlay: boolean): MovingPhotoViewAttribute;
23461847f8eSopenharmony_ci
23561847f8eSopenharmony_ci    /**
23661847f8eSopenharmony_ci     * Sets whether to enable moving photo analyzer. If the value is true, the moving photo can
23761847f8eSopenharmony_ci     * be analyzed by AI.
23861847f8eSopenharmony_ci     *
23961847f8eSopenharmony_ci     * @param { boolean } enabled - whether to enable moving photo analyzer
24061847f8eSopenharmony_ci     * @returns { MovingPhotoViewAttribute }
24161847f8eSopenharmony_ci     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
24261847f8eSopenharmony_ci     * @crossplatform
24361847f8eSopenharmony_ci     * @atomicservice
24461847f8eSopenharmony_ci     * @uicomponent
24561847f8eSopenharmony_ci     * @since 14
24661847f8eSopenharmony_ci     */
24761847f8eSopenharmony_ci    enableAnalyzer(enabled: boolean): MovingPhotoViewAttribute;
24861847f8eSopenharmony_ci}
24961847f8eSopenharmony_ci/**
25061847f8eSopenharmony_ci * Defines the MovingPhotoView controller.
25161847f8eSopenharmony_ci *
25261847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
25361847f8eSopenharmony_ci * @crossplatform
25461847f8eSopenharmony_ci * @atomicservice
25561847f8eSopenharmony_ci * @since 12
25661847f8eSopenharmony_ci */
25761847f8eSopenharmony_ciexport class MovingPhotoViewController {
25861847f8eSopenharmony_ci    /**
25961847f8eSopenharmony_ci     * constructor.
26061847f8eSopenharmony_ci     *
26161847f8eSopenharmony_ci     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
26261847f8eSopenharmony_ci     * @crossplatform
26361847f8eSopenharmony_ci     * @atomicservice
26461847f8eSopenharmony_ci     * @since 12
26561847f8eSopenharmony_ci     */
26661847f8eSopenharmony_ci    constructor();
26761847f8eSopenharmony_ci    /**
26861847f8eSopenharmony_ci     * Start play moving photo.
26961847f8eSopenharmony_ci     *
27061847f8eSopenharmony_ci     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
27161847f8eSopenharmony_ci     * @crossplatform
27261847f8eSopenharmony_ci     * @atomicservice
27361847f8eSopenharmony_ci     * @since 12
27461847f8eSopenharmony_ci     */
27561847f8eSopenharmony_ci    startPlayback();
27661847f8eSopenharmony_ci    /**
27761847f8eSopenharmony_ci     * Stop play moving photo.
27861847f8eSopenharmony_ci     *
27961847f8eSopenharmony_ci     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
28061847f8eSopenharmony_ci     * @crossplatform
28161847f8eSopenharmony_ci     * @atomicservice
28261847f8eSopenharmony_ci     * @since 12
28361847f8eSopenharmony_ci     */
28461847f8eSopenharmony_ci    stopPlayback();
28561847f8eSopenharmony_ci}
28661847f8eSopenharmony_ci/**
28761847f8eSopenharmony_ci * Defines MovingPhotoView Component.
28861847f8eSopenharmony_ci *
28961847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
29061847f8eSopenharmony_ci * @crossplatform
29161847f8eSopenharmony_ci * @atomicservice
29261847f8eSopenharmony_ci * @since 12
29361847f8eSopenharmony_ci */
29461847f8eSopenharmony_cideclare const MovingPhotoView: MovingPhotoViewInterface;
29561847f8eSopenharmony_ci/**
29661847f8eSopenharmony_ci * Defines MovingPhotoView Component instance.
29761847f8eSopenharmony_ci *
29861847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
29961847f8eSopenharmony_ci * @crossplatform
30061847f8eSopenharmony_ci * @atomicservice
30161847f8eSopenharmony_ci * @since 12
30261847f8eSopenharmony_ci */
30361847f8eSopenharmony_cideclare const MovingPhotoViewInstance: MovingPhotoViewAttribute;
304