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 * image ai options of MovingPhotoView. 55 * 56 * @type { ?ImageAIOptions } 57 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 58 * @crossplatform 59 * @atomicservice 60 * @uicomponent 61 * @since 14 62 */ 63 imageAIOptions?: ImageAIOptions; 64} 65/** 66 * Defines the moving photo view interface. 67 * 68 * @interface MovingPhotoViewInterface 69 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 70 * @crossplatform 71 * @atomicservice 72 * @since 12 73 */ 74interface MovingPhotoViewInterface { 75 /** 76 * Set the options. 77 * 78 * @param { MovingPhotoViewOptions } options 79 * @returns { MovingPhotoViewAttribute } 80 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 81 * @crossplatform 82 * @atomicservice 83 * @since 12 84 */ 85 (options: MovingPhotoViewOptions): MovingPhotoViewAttribute; 86} 87 88/** 89 * function that moving photo view media events callback. 90 * 91 * @typedef { function } MovingPhotoViewEventCallback 92 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 93 * @crossplatform 94 * @atomicservice 95 * @since 12 96 */ 97declare type MovingPhotoViewEventCallback = () => void; 98 99/** 100 * Defines the moving photo view attribute functions. 101 * 102 * @extends CommonMethod<MovingPhotoViewAttribute> 103 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 104 * @crossplatform 105 * @atomicservice 106 * @since 12 107 */ 108declare class MovingPhotoViewAttribute extends CommonMethod<MovingPhotoViewAttribute> { 109 /** 110 * Called when judging whether the video is muted. 111 * 112 * @param { boolean } isMuted 113 * @returns { MovingPhotoViewAttribute } 114 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 115 * @crossplatform 116 * @atomicservice 117 * @since 12 118 */ 119 muted(isMuted: boolean): MovingPhotoViewAttribute; 120 /** 121 * Called when determining the zoom type of the view. 122 * 123 * @param { ImageFit } value 124 * @returns { MovingPhotoViewAttribute } 125 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 126 * @crossplatform 127 * @atomicservice 128 * @since 12 129 */ 130 objectFit(value: ImageFit): MovingPhotoViewAttribute; 131 /** 132 * Called when the image load completed. 133 * 134 * @param { MovingPhotoViewEventCallback } callback 135 * @returns { MovingPhotoViewAttribute } 136 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 137 * @crossplatform 138 * @atomicservice 139 * @since 13 140 */ 141 onComplete(callback: MovingPhotoViewEventCallback): MovingPhotoViewAttribute; 142 /** 143 * Called when the video is played. 144 * 145 * @param { MovingPhotoViewEventCallback } callback 146 * @returns { MovingPhotoViewAttribute } 147 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 148 * @crossplatform 149 * @atomicservice 150 * @since 12 151 */ 152 onStart(callback: MovingPhotoViewEventCallback): MovingPhotoViewAttribute; 153 /** 154 * Called when the video playback stopped. 155 * 156 * @param { MovingPhotoViewEventCallback } callback 157 * @returns { MovingPhotoViewAttribute } 158 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 159 * @crossplatform 160 * @atomicservice 161 * @since 12 162 */ 163 onStop(callback: MovingPhotoViewEventCallback): MovingPhotoViewAttribute; 164 /** 165 * Called when the video playback paused. 166 * 167 * @param { MovingPhotoViewEventCallback } callback 168 * @returns { MovingPhotoViewAttribute } 169 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 170 * @crossplatform 171 * @atomicservice 172 * @since 12 173 */ 174 onPause(callback: MovingPhotoViewEventCallback): MovingPhotoViewAttribute; 175 /** 176 * Called when the video playback ends. 177 * 178 * @param { MovingPhotoViewEventCallback } callback 179 * @returns { MovingPhotoViewAttribute } 180 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 181 * @crossplatform 182 * @atomicservice 183 * @since 12 184 */ 185 onFinish(callback: MovingPhotoViewEventCallback): MovingPhotoViewAttribute; 186 /** 187 * Called when playback fails. 188 * 189 * @param { MovingPhotoViewEventCallback } callback 190 * @returns { MovingPhotoViewAttribute } 191 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 192 * @crossplatform 193 * @atomicservice 194 * @since 12 195 */ 196 onError(callback: MovingPhotoViewEventCallback): MovingPhotoViewAttribute; 197 /** 198 * Sets automatic play period, If not set, the moving photo plays in the full video duration. 199 * If set, the moving photo plays in the automatic play period. 200 * 201 * @param { number } startTime video plays start time 202 * @param { number } endTime video plays end time 203 * @returns { MovingPhotoViewAttribute } 204 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 205 * @crossplatform 206 * @atomicservice 207 * @since 13 208 */ 209 autoPlayPeriod(startTime: number, endTime: number): MovingPhotoViewAttribute; 210 /** 211 * Sets whether to allow automatic play. If the value is true, the moving photo starts 212 * automatic after the resource is loaded. 213 * 214 * @param { boolean } isAutoPlay Whether to automatic play 215 * @returns { MovingPhotoViewAttribute } 216 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 217 * @crossplatform 218 * @atomicservice 219 * @since 13 220 */ 221 autoPlay(isAutoPlay: boolean): MovingPhotoViewAttribute; 222 /** 223 * Sets whether to allow repeat play. If the value is true, the moving photo plays 224 * repeat after the resource is loaded. 225 * 226 * @param { boolean } isRepeatPlay Whether to repeat play 227 * @returns { MovingPhotoViewAttribute } 228 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 229 * @crossplatform 230 * @atomicservice 231 * @since 13 232 */ 233 repeatPlay(isRepeatPlay: boolean): MovingPhotoViewAttribute; 234 235 /** 236 * Sets whether to enable moving photo analyzer. If the value is true, the moving photo can 237 * be analyzed by AI. 238 * 239 * @param { boolean } enabled - whether to enable moving photo analyzer 240 * @returns { MovingPhotoViewAttribute } 241 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 242 * @crossplatform 243 * @atomicservice 244 * @uicomponent 245 * @since 14 246 */ 247 enableAnalyzer(enabled: boolean): MovingPhotoViewAttribute; 248} 249/** 250 * Defines the MovingPhotoView controller. 251 * 252 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 253 * @crossplatform 254 * @atomicservice 255 * @since 12 256 */ 257export class MovingPhotoViewController { 258 /** 259 * constructor. 260 * 261 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 262 * @crossplatform 263 * @atomicservice 264 * @since 12 265 */ 266 constructor(); 267 /** 268 * Start play moving photo. 269 * 270 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 271 * @crossplatform 272 * @atomicservice 273 * @since 12 274 */ 275 startPlayback(); 276 /** 277 * Stop play moving photo. 278 * 279 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 280 * @crossplatform 281 * @atomicservice 282 * @since 12 283 */ 284 stopPlayback(); 285} 286/** 287 * Defines MovingPhotoView Component. 288 * 289 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 290 * @crossplatform 291 * @atomicservice 292 * @since 12 293 */ 294declare const MovingPhotoView: MovingPhotoViewInterface; 295/** 296 * Defines MovingPhotoView Component instance. 297 * 298 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 299 * @crossplatform 300 * @atomicservice 301 * @since 12 302 */ 303declare const MovingPhotoViewInstance: MovingPhotoViewAttribute; 304