• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file A component which support applications to show moving photo data
18 * @kit MediaLibraryKit
19 */
20
21import photoAccessHelper from './@ohos.file.photoAccessHelper';
22
23/**
24 * Defines the moving photo view options.
25 *
26 * @interface MovingPhotoViewOptions
27 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
28 * @crossplatform
29 * @atomicservice
30 * @since 12
31 */
32declare interface MovingPhotoViewOptions {
33    /**
34     * moving photo data.
35     *
36     * @type { photoAccessHelper.MovingPhoto }
37     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
38     * @crossplatform
39     * @atomicservice
40     * @since 12
41     */
42    movingPhoto: photoAccessHelper.MovingPhoto;
43    /**
44     * controller of MovingPhotoView.
45     *
46     * @type { ?MovingPhotoViewController }
47     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
48     * @crossplatform
49     * @atomicservice
50     * @since 12
51     */
52    controller?: MovingPhotoViewController;
53}
54/**
55 * Defines the moving photo view interface.
56 *
57 * @interface MovingPhotoViewInterface
58 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
59 * @crossplatform
60 * @atomicservice
61 * @since 12
62 */
63interface MovingPhotoViewInterface {
64    /**
65     * Set the options.
66     *
67     * @param { MovingPhotoViewOptions } options
68     * @returns { MovingPhotoViewAttribute }
69     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
70     * @crossplatform
71     * @atomicservice
72     * @since 12
73     */
74    (options: MovingPhotoViewOptions): MovingPhotoViewAttribute;
75}
76
77/**
78 * function that moving photo view media events callback.
79 *
80 * @typedef { function } MovingPhotoViewEventCallback
81 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
82 * @crossplatform
83 * @atomicservice
84 * @since 12
85 */
86declare type MovingPhotoViewEventCallback = () => void;
87
88/**
89 * Defines the moving photo view attribute functions.
90 *
91 * @extends CommonMethod<MovingPhotoViewAttribute>
92 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
93 * @crossplatform
94 * @atomicservice
95 * @since 12
96 */
97declare class MovingPhotoViewAttribute extends CommonMethod<MovingPhotoViewAttribute> {
98    /**
99     * Called when judging whether the video is muted.
100     *
101     * @param { boolean } isMuted
102     * @returns { MovingPhotoViewAttribute }
103     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
104     * @crossplatform
105     * @atomicservice
106     * @since 12
107     */
108    muted(isMuted: boolean): MovingPhotoViewAttribute;
109	/**
110     * Called when determining the zoom type of the view.
111     *
112     * @param { ImageFit } value
113     * @returns { MovingPhotoViewAttribute }
114     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
115     * @crossplatform
116     * @atomicservice
117     * @since 12
118     */
119    objectFit(value: ImageFit): MovingPhotoViewAttribute;
120    /**
121     * Called when the image load completed.
122     *
123     * @param { MovingPhotoViewEventCallback } callback
124     * @returns { MovingPhotoViewAttribute }
125     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
126     * @crossplatform
127     * @atomicservice
128     * @since 13
129     */
130    onComplete(callback: MovingPhotoViewEventCallback): MovingPhotoViewAttribute;
131    /**
132     * Called when the video is played.
133     *
134     * @param { MovingPhotoViewEventCallback } callback
135     * @returns { MovingPhotoViewAttribute }
136     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
137     * @crossplatform
138     * @atomicservice
139     * @since 12
140     */
141    onStart(callback: MovingPhotoViewEventCallback): MovingPhotoViewAttribute;
142    /**
143     * Called when the video playback stopped.
144     *
145     * @param { MovingPhotoViewEventCallback } callback
146     * @returns { MovingPhotoViewAttribute }
147     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
148     * @crossplatform
149     * @atomicservice
150     * @since 12
151     */
152    onStop(callback: MovingPhotoViewEventCallback): MovingPhotoViewAttribute;
153    /**
154     * Called when the video playback paused.
155     *
156     * @param { MovingPhotoViewEventCallback } callback
157     * @returns { MovingPhotoViewAttribute }
158     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
159     * @crossplatform
160     * @atomicservice
161     * @since 12
162     */
163    onPause(callback: MovingPhotoViewEventCallback): MovingPhotoViewAttribute;
164    /**
165     * Called when the video playback ends.
166     *
167     * @param { MovingPhotoViewEventCallback } callback
168     * @returns { MovingPhotoViewAttribute }
169     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
170     * @crossplatform
171     * @atomicservice
172     * @since 12
173     */
174    onFinish(callback: MovingPhotoViewEventCallback): MovingPhotoViewAttribute;
175    /**
176     * Called when playback fails.
177     *
178     * @param { MovingPhotoViewEventCallback } callback
179     * @returns { MovingPhotoViewAttribute }
180     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
181     * @crossplatform
182     * @atomicservice
183     * @since 12
184     */
185    onError(callback: MovingPhotoViewEventCallback): MovingPhotoViewAttribute;
186    /**
187     * Sets automatic play period, If not set, the moving photo plays in the full video duration.
188     * If set, the moving photo plays in the automatic play period.
189     *
190     * @param { number } startTime video plays start time
191     * @param { number } endTime   video plays end time
192     * @returns { MovingPhotoViewAttribute }
193     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
194     * @crossplatform
195     * @atomicservice
196     * @since 13
197     */
198    autoPlayPeriod(startTime: number, endTime: number): MovingPhotoViewAttribute;
199    /**
200     * Sets whether to allow automatic play. If the value is true, the moving photo starts
201     * automatic after the resource is loaded.
202     *
203     * @param { boolean } isAutoPlay  Whether to automatic play
204     * @returns { MovingPhotoViewAttribute }
205     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
206     * @crossplatform
207     * @atomicservice
208     * @since 13
209     */
210    autoPlay(isAutoPlay: boolean): MovingPhotoViewAttribute;
211    /**
212     * Sets whether to allow repeat play. If the value is true, the moving photo plays
213     * repeat after the resource is loaded.
214     *
215     * @param { boolean } isRepeatPlay  Whether to repeat play
216     * @returns { MovingPhotoViewAttribute }
217     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
218     * @crossplatform
219     * @atomicservice
220     * @since 13
221     */
222    repeatPlay(isRepeatPlay: boolean): MovingPhotoViewAttribute;
223}
224/**
225 * Defines the MovingPhotoView controller.
226 *
227 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
228 * @crossplatform
229 * @atomicservice
230 * @since 12
231 */
232export class MovingPhotoViewController {
233    /**
234     * constructor.
235     *
236     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
237     * @crossplatform
238     * @atomicservice
239     * @since 12
240     */
241    constructor();
242    /**
243     * Start play moving photo.
244     *
245     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
246     * @crossplatform
247     * @atomicservice
248     * @since 12
249     */
250    startPlayback();
251    /**
252     * Stop play moving photo.
253     *
254     * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
255     * @crossplatform
256     * @atomicservice
257     * @since 12
258     */
259    stopPlayback();
260}
261/**
262 * Defines MovingPhotoView Component.
263 *
264 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
265 * @crossplatform
266 * @atomicservice
267 * @since 12
268 */
269declare const MovingPhotoView: MovingPhotoViewInterface;
270/**
271 * Defines MovingPhotoView Component instance.
272 *
273 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
274 * @crossplatform
275 * @atomicservice
276 * @since 12
277 */
278declare const MovingPhotoViewInstance: MovingPhotoViewAttribute;
279