1/* 2 * Copyright (C) 2022 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 18 * @kit MediaLibraryKit 19 */ 20 21import { AsyncCallback, Callback } from './@ohos.base'; 22import Context from './application/Context'; 23import image from './@ohos.multimedia.image'; 24 25/** 26 * @name mediaLibrary 27 * @since 6 28 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 29 * @deprecated since 9 30 * @useinstead ohos.file.picker 31 */ 32declare namespace mediaLibrary { 33 /** 34 * Obtains a MediaLibrary instance. 35 * @since 6 36 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 37 * @FAModelOnly 38 * @returns Returns a MediaLibrary instance if the operation is successful; returns null otherwise. 39 * @deprecated since 9 40 * @useinstead ohos.file.picker 41 */ 42 function getMediaLibrary(): MediaLibrary; 43 /** 44 * Returns an instance of MediaLibrary 45 * @since 8 46 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 47 * @StageModelOnly 48 * @param context hap context information 49 * @returns Instance of MediaLibrary 50 * @deprecated since 9 51 * @useinstead ohos.file.picker 52 */ 53 function getMediaLibrary(context: Context): MediaLibrary; 54 55 /** 56 * Enumeration types for different kind of Media Files 57 * @since 8 58 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 59 * @deprecated since 9 60 * @useinstead ohos.file.picker 61 */ 62 enum MediaType { 63 /** 64 * File media type 65 * @since 8 66 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 67 * @deprecated since 9 68 * @useinstead ohos.file.picker 69 */ 70 FILE = 0, 71 /** 72 * Image media type 73 * @since 8 74 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 75 * @deprecated since 9 76 * @useinstead ohos.file.picker 77 */ 78 IMAGE, 79 /** 80 * Video media type 81 * @since 8 82 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 83 * @deprecated since 9 84 * @useinstead ohos.file.picker 85 */ 86 VIDEO, 87 /** 88 * Audio media type 89 * @since 8 90 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 91 * @deprecated since 9 92 * @useinstead ohos.file.picker 93 */ 94 AUDIO 95 } 96 97 /** 98 * Describes media resource options. 99 * @since 6 100 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 101 * @deprecated since 9 102 */ 103 interface MediaAssetOption { 104 /** 105 * URI of the media source. 106 * @since 6 107 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 108 * @deprecated since 9 109 */ 110 src: string; 111 /** 112 * Multipurpose Internet Mail Extensions (MIME) type of the media. 113 * @since 6 114 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 115 * @deprecated since 9 116 */ 117 mimeType: string; 118 /** 119 * Relative path for storing media resources. 120 * @since 6 121 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 122 * @deprecated since 9 123 */ 124 relativePath?: string; 125 } 126 127 /** 128 * Describes media selection options. 129 * @since 6 130 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 131 * @deprecated since 9 132 */ 133 interface MediaSelectOption { 134 /** 135 * Media type, which can be image, video, or media (indicating both image and video). 136 * @since 6 137 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 138 * @deprecated since 9 139 */ 140 type: 'image' | 'video' | 'media'; 141 /** 142 * Maximum number of media items that can be selected 143 * @since 6 144 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 145 * @deprecated since 9 146 */ 147 count: number; 148 } 149 150 /** 151 * Provides methods to encapsulate file attributes. 152 * @since 7 153 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 154 * @deprecated since 9 155 * @useinstead ohos.file.picker 156 */ 157 interface FileAsset { 158 /** 159 * File ID. 160 * @since 7 161 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 162 * @deprecated since 9 163 * @useinstead ohos.file.picker 164 */ 165 readonly id: number; 166 /** 167 * URI of the file. 168 * @since 7 169 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 170 * @deprecated since 9 171 * @useinstead ohos.file.picker 172 */ 173 readonly uri: string; 174 /** 175 * MIME type, for example, video/mp4, audio/mp4, or audio/amr-wb. 176 * @since 7 177 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 178 * @deprecated since 9 179 * @useinstead ohos.file.picker 180 */ 181 readonly mimeType: string; 182 /** 183 * Media type, for example, IMAGE, VIDEO, FILE, AUDIO 184 * @since 8 185 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 186 * @deprecated since 9 187 * @useinstead ohos.file.picker 188 */ 189 readonly mediaType: MediaType; 190 /** 191 * Display name (with a file name extension) of the file. 192 * @since 7 193 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 194 * @deprecated since 9 195 * @useinstead ohos.file.picker 196 */ 197 displayName: string; 198 /** 199 * File name title (without the file name extension). 200 * @since 7 201 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 202 * @deprecated since 9 203 * @useinstead ohos.file.picker 204 */ 205 title: string; 206 /** 207 * Relative Path of the file. 208 * @since 8 209 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 210 * @deprecated since 9 211 * @useinstead ohos.file.picker 212 */ 213 relativePath: string; 214 /** 215 * Parent folder's file_id of the file. 216 * @since 8 217 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 218 * @deprecated since 9 219 * @useinstead ohos.file.picker 220 */ 221 readonly parent: number; 222 /** 223 * Data size of the file. 224 * @since 7 225 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 226 * @deprecated since 9 227 * @useinstead ohos.file.picker 228 */ 229 readonly size: number; 230 /** 231 * Date (timestamp) when the file was added. 232 * @since 7 233 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 234 * @deprecated since 9 235 * @useinstead ohos.file.picker 236 */ 237 readonly dateAdded: number; 238 /** 239 * Date (timestamp) when the file was modified. 240 * @since 7 241 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 242 * @deprecated since 9 243 * @useinstead ohos.file.picker 244 */ 245 readonly dateModified: number; 246 /** 247 * Date (timestamp) when the file was taken. 248 * @since 7 249 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 250 * @deprecated since 9 251 * @useinstead ohos.file.picker 252 */ 253 readonly dateTaken: number; 254 /** 255 * Artist of the audio file. 256 * @since 8 257 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 258 * @deprecated since 9 259 * @useinstead ohos.file.picker 260 */ 261 readonly artist: string; 262 /** 263 * audioAlbum of the audio file. 264 * @since 8 265 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 266 * @deprecated since 9 267 * @useinstead ohos.file.picker 268 */ 269 readonly audioAlbum: string; 270 /** 271 * Display width of the file. This is valid only for videos and images. 272 * @since 7 273 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 274 * @deprecated since 9 275 * @useinstead ohos.file.picker 276 */ 277 readonly width: number; 278 /** 279 * Display height of the file. This is valid only for videos and images. 280 * @since 7 281 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 282 * @deprecated since 9 283 * @useinstead ohos.file.picker 284 */ 285 readonly height: number; 286 /** 287 * Rotation angle of the file, in degrees. 288 * The rotation angle can be 0, 90, 180, or 270 degrees. This is valid only for videos. 289 * @since 7 290 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 291 * @deprecated since 9 292 * @useinstead ohos.file.picker 293 */ 294 orientation: number; 295 /** 296 * duration of the audio and video file. 297 * @since 8 298 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 299 * @deprecated since 9 300 * @useinstead ohos.file.picker 301 */ 302 readonly duration: number; 303 /** 304 * ID of the album where the file is located. 305 * @since 7 306 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 307 * @deprecated since 9 308 * @useinstead ohos.file.picker 309 */ 310 readonly albumId: number; 311 /** 312 * URI of the album where the file is located. 313 * @since 8 314 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 315 * @deprecated since 9 316 * @useinstead ohos.file.picker 317 */ 318 readonly albumUri: string; 319 /** 320 * Name of the album where the file is located. 321 * @since 7 322 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 323 * @deprecated since 9 324 * @useinstead ohos.file.picker 325 */ 326 readonly albumName: string; 327 328 /** 329 * If it is a directory where the file is located. 330 * @since 8 331 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 332 * @permission ohos.permission.READ_MEDIA 333 * @param callback Callback return the result of isDirectory. 334 * @deprecated since 9 335 * @useinstead ohos.file.picker 336 */ 337 isDirectory(callback: AsyncCallback<boolean>): void; 338 /** 339 * If it is a directory where the file is located. 340 * @since 8 341 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 342 * @permission ohos.permission.READ_MEDIA 343 * @deprecated since 9 344 * @useinstead ohos.file.picker 345 */ 346 isDirectory(): Promise<boolean>; 347 /** 348 * Modify meta data where the file is located. 349 * @since 8 350 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 351 * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA 352 * @param callback no value will be returned. 353 * @deprecated since 9 354 * @useinstead ohos.file.picker 355 */ 356 commitModify(callback: AsyncCallback<void>): void; 357 /** 358 * Modify meta data where the file is located. 359 * @since 8 360 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 361 * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA 362 * @deprecated since 9 363 * @useinstead ohos.file.picker 364 */ 365 commitModify(): Promise<void>; 366 /** 367 * Open the file is located. 368 * @since 8 369 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 370 * @permission ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA 371 * @param mode mode for open, for example: rw, r, w. 372 * @param callback Callback return the fd of the file. 373 * @deprecated since 9 374 * @useinstead ohos.file.picker 375 */ 376 open(mode: string, callback: AsyncCallback<number>): void; 377 /** 378 * Open the file is located. 379 * @since 8 380 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 381 * @permission ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA 382 * @param mode mode for open, for example: rw, r, w. 383 * @deprecated since 9 384 * @useinstead ohos.file.picker 385 */ 386 open(mode: string): Promise<number>; 387 /** 388 * Close the file is located. 389 * @since 8 390 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 391 * @permission ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA 392 * @param fd fd of the file which had been opened 393 * @param callback no value will be returned. 394 * @deprecated since 9 395 * @useinstead ohos.file.picker 396 */ 397 close(fd: number, callback: AsyncCallback<void>): void; 398 /** 399 * Close the file is located. 400 * @since 8 401 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 402 * @permission ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA 403 * @param fd fd of the file which had been opened 404 * @deprecated since 9 405 * @useinstead ohos.file.picker 406 */ 407 close(fd: number): Promise<void>; 408 /** 409 * Get thumbnail of the file when the file is located. 410 * @since 8 411 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 412 * @permission ohos.permission.READ_MEDIA 413 * @param callback Callback used to return the thumbnail's pixelmap. 414 * @deprecated since 9 415 * @useinstead ohos.file.picker 416 */ 417 getThumbnail(callback: AsyncCallback<image.PixelMap>): void; 418 /** 419 * Get thumbnail of the file when the file is located. 420 * @since 8 421 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 422 * @permission ohos.permission.READ_MEDIA 423 * @param size thumbnail's size 424 * @param callback Callback used to return the thumbnail's pixelmap. 425 * @deprecated since 9 426 * @useinstead ohos.file.picker 427 */ 428 getThumbnail(size: Size, callback: AsyncCallback<image.PixelMap>): void; 429 /** 430 * Get thumbnail of the file when the file is located. 431 * @since 8 432 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 433 * @permission ohos.permission.READ_MEDIA 434 * @param size thumbnail's size 435 * @deprecated since 9 436 * @useinstead ohos.file.picker 437 */ 438 getThumbnail(size?: Size): Promise<image.PixelMap>; 439 /** 440 * Set favorite for the file when the file is located. 441 * @since 8 442 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 443 * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA 444 * @param isFavorite true is favorite file, false is not favorite file 445 * @param callback Callback used to return, No value is returned. 446 * @deprecated since 9 447 * @useinstead ohos.file.picker 448 */ 449 favorite(isFavorite: boolean, callback: AsyncCallback<void>): void; 450 /** 451 * Set favorite for the file when the file is located. 452 * @since 8 453 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 454 * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA 455 * @param isFavorite true is favorite file, false is not favorite file 456 * @deprecated since 9 457 * @useinstead ohos.file.picker 458 */ 459 favorite(isFavorite: boolean): Promise<void>; 460 /** 461 * If the file is favorite when the file is located. 462 * @since 8 463 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 464 * @permission ohos.permission.READ_MEDIA 465 * @param callback Callback used to return true or false. 466 * @deprecated since 9 467 * @useinstead ohos.file.picker 468 */ 469 isFavorite(callback: AsyncCallback<boolean>): void; 470 /** 471 * If the file is favorite when the file is located. 472 * @since 8 473 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 474 * @permission ohos.permission.READ_MEDIA 475 * @deprecated since 9 476 * @useinstead ohos.file.picker 477 */ 478 isFavorite(): Promise<boolean>; 479 /** 480 * Set trash for the file when the file is located. 481 * @since 8 482 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 483 * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA 484 * @param isTrash true is trashed file, false is not trashed file 485 * @param callback Callback used to return, No value is returned. 486 * @deprecated since 9 487 * @useinstead ohos.file.picker 488 */ 489 trash(isTrash: boolean, callback: AsyncCallback<void>): void; 490 /** 491 * Set trash for the file when the file is located. 492 * @since 8 493 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 494 * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA 495 * @param isTrash true is trashed file, false is not trashed file 496 * @deprecated since 9 497 * @useinstead ohos.file.picker 498 */ 499 trash(isTrash: boolean): Promise<void>; 500 /** 501 * If the file is in trash when the file is located. 502 * @since 8 503 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 504 * @permission ohos.permission.READ_MEDIA 505 * @param callback Callback used to return true or false. 506 * @deprecated since 9 507 * @useinstead ohos.file.picker 508 */ 509 isTrash(callback: AsyncCallback<boolean>): void; 510 /** 511 * If the file is in trash when the file is located. 512 * @since 8 513 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 514 * @permission ohos.permission.READ_MEDIA 515 * @deprecated since 9 516 * @useinstead ohos.file.picker 517 */ 518 isTrash(): Promise<boolean>; 519 } 520 521 /** 522 * Describes MediaFetchOptions's selection 523 * @since 8 524 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 525 * @deprecated since 9 526 * @useinstead ohos.file.picker 527 */ 528 enum FileKey { 529 /** 530 * File ID 531 * @since 8 532 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 533 * @deprecated since 9 534 * @useinstead ohos.file.picker 535 */ 536 ID = "file_id", 537 /** 538 * Relative Path 539 * @since 8 540 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 541 * @deprecated since 9 542 * @useinstead ohos.file.picker 543 */ 544 RELATIVE_PATH = "relative_path", 545 /** 546 * File name 547 * @since 8 548 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 549 * @deprecated since 9 550 * @useinstead ohos.file.picker 551 */ 552 DISPLAY_NAME = "display_name", 553 /** 554 * Parent folder file id 555 * @since 8 556 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 557 * @deprecated since 9 558 * @useinstead ohos.file.picker 559 */ 560 PARENT = "parent", 561 /** 562 * Mime type of the file 563 * @since 8 564 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 565 * @deprecated since 9 566 * @useinstead ohos.file.picker 567 */ 568 MIME_TYPE = "mime_type", 569 /** 570 * Media type of the file 571 * @since 8 572 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 573 * @deprecated since 9 574 * @useinstead ohos.file.picker 575 */ 576 MEDIA_TYPE = "media_type", 577 /** 578 * Size of the file 579 * @since 8 580 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 581 * @deprecated since 9 582 * @useinstead ohos.file.picker 583 */ 584 SIZE = "size", 585 /** 586 * Date of the file creation 587 * @since 8 588 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 589 * @deprecated since 9 590 * @useinstead ohos.file.picker 591 */ 592 DATE_ADDED = "date_added", 593 /** 594 * Modify date of the file 595 * @since 8 596 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 597 * @deprecated since 9 598 * @useinstead ohos.file.picker 599 */ 600 DATE_MODIFIED = "date_modified", 601 /** 602 * Date taken of the file 603 * @since 8 604 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 605 * @deprecated since 9 606 * @useinstead ohos.file.picker 607 */ 608 DATE_TAKEN = "date_taken", 609 /** 610 * Title of the file 611 * @since 8 612 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 613 * @deprecated since 9 614 * @useinstead ohos.file.picker 615 */ 616 TITLE = "title", 617 /** 618 * Artist of the audio file 619 * @since 8 620 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 621 * @deprecated since 9 622 * @useinstead ohos.file.picker 623 */ 624 ARTIST = "artist", 625 /** 626 * Audio album of the audio file 627 * @since 8 628 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 629 * @deprecated since 9 630 * @useinstead ohos.file.picker 631 */ 632 AUDIOALBUM = "audio_album", 633 /** 634 * Duration of the audio and video file 635 * @since 8 636 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 637 * @deprecated since 9 638 * @useinstead ohos.file.picker 639 */ 640 DURATION = "duration", 641 /** 642 * Width of the image file 643 * @since 8 644 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 645 * @deprecated since 9 646 * @useinstead ohos.file.picker 647 */ 648 WIDTH = "width", 649 /** 650 * Height of the image file 651 * @since 8 652 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 653 * @deprecated since 9 654 * @useinstead ohos.file.picker 655 */ 656 HEIGHT = "height", 657 /** 658 * Orientation of the image file 659 * @since 8 660 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 661 * @deprecated since 9 662 * @useinstead ohos.file.picker 663 */ 664 ORIENTATION = "orientation", 665 /** 666 * Album id of the file 667 * @since 8 668 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 669 * @deprecated since 9 670 * @useinstead ohos.file.picker 671 */ 672 ALBUM_ID = "bucket_id", 673 /** 674 * Album name of the file 675 * @since 8 676 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 677 * @deprecated since 9 678 * @useinstead ohos.file.picker 679 */ 680 ALBUM_NAME = "bucket_display_name", 681 } 682 683 /** 684 * Fetch parameters applicable on images, videos, audios, albums and other media 685 * @since 7 686 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 687 * @deprecated since 9 688 * @useinstead ohos.file.picker 689 */ 690 interface MediaFetchOptions { 691 /** 692 * Fields to retrieve, for example, selections: "media_type =? OR media_type =?". 693 * @since 7 694 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 695 * @deprecated since 9 696 * @useinstead ohos.file.picker 697 */ 698 selections: string; 699 /** 700 * Conditions for retrieval, for example, selectionArgs: [IMAGE, VIDEO]. 701 * @since 7 702 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 703 * @deprecated since 9 704 * @useinstead ohos.file.picker 705 */ 706 selectionArgs: Array<string>; 707 /** 708 * Sorting criterion of the retrieval results, for example, order: "dateTaken DESC,display_name DESC, file_id DESC". 709 * @since 7 710 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 711 * @deprecated since 9 712 * @useinstead ohos.file.picker 713 */ 714 order?: string; 715 /** 716 * uri for retrieval 717 * @since 8 718 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 719 * @deprecated since 9 720 * @useinstead ohos.file.picker 721 */ 722 uri?: string; 723 /** 724 * networkId for retrieval 725 * @since 8 726 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 727 * @deprecated since 9 728 * @useinstead ohos.file.picker 729 */ 730 networkId?: string; 731 /** 732 * extendArgs for retrieval 733 * @since 8 734 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 735 * @deprecated since 9 736 * @useinstead ohos.file.picker 737 */ 738 extendArgs?: string; 739 } 740 741 /** 742 * Implements file retrieval. 743 * @since 7 744 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 745 * @deprecated since 9 746 * @useinstead ohos.file.picker 747 */ 748 interface FetchFileResult { 749 /** 750 * Obtains the total number of files in the file retrieval result. 751 * @since 7 752 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 753 * @returns Total number of files. 754 * @deprecated since 9 755 * @useinstead ohos.file.picker 756 */ 757 getCount(): number; 758 /** 759 * Checks whether the result set points to the last row. 760 * @since 7 761 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 762 * @returns Whether the file is the last one. 763 * @deprecated since 9 764 * @useinstead ohos.file.picker 765 * You need to check whether the file is the last one before calling getNextObject, 766 * which returns the next file only when False is returned for this method. 767 */ 768 isAfterLast(): boolean; 769 /** 770 * Releases the FetchFileResult instance and invalidates it. Other methods cannot be called. 771 * @since 7 772 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 773 * @deprecated since 9 774 * @useinstead ohos.file.picker 775 */ 776 close(): void; 777 /** 778 * Obtains the first FileAsset in the file retrieval result. This method uses a callback to return the file. 779 * @since 7 780 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 781 * @param callback Callback used to return the file in the format of a FileAsset instance. 782 * @deprecated since 9 783 * @useinstead ohos.file.picker 784 */ 785 getFirstObject(callback: AsyncCallback<FileAsset>): void; 786 /** 787 * Obtains the first FileAsset in the file retrieval result. This method uses a promise to return the file. 788 * @since 7 789 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 790 * @returns A Promise instance used to return the file in the format of a FileAsset instance. 791 * @deprecated since 9 792 * @useinstead ohos.file.picker 793 */ 794 getFirstObject(): Promise<FileAsset>; 795 /** 796 * Obtains the next FileAsset in the file retrieval result. 797 * This method uses a callback to return the file. 798 * Before calling this method, you must use isAfterLast() to check whether the result set points to the last row. 799 * This method returns the next file only when False is returned for isAfterLast(). 800 * @since 7 801 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 802 * @param callback Callback used to return the file in the format of a FileAsset instance. 803 * @deprecated since 9 804 * @useinstead ohos.file.picker 805 */ 806 getNextObject(callback: AsyncCallback<FileAsset>): void; 807 /** 808 * Obtains the next FileAsset in the file retrieval result. 809 * This method uses a promise to return the file. 810 * Before calling this method, you must use isAfterLast() to check whether the result set points to the last row. 811 * This method returns the next file only when False is returned for isAfterLast(). 812 * @since 7 813 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 814 * @returns A Promise instance used to return the file in the format of a FileAsset instance. 815 * @deprecated since 9 816 * @useinstead ohos.file.picker 817 */ 818 getNextObject(): Promise<FileAsset>; 819 /** 820 * Obtains the last FileAsset in the file retrieval result. This method uses a callback to return the file. 821 * @since 7 822 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 823 * @param callback Callback used to return the file in the format of a FileAsset instance. 824 * @deprecated since 9 825 * @useinstead ohos.file.picker 826 */ 827 getLastObject(callback: AsyncCallback<FileAsset>): void; 828 /** 829 * Obtains the last FileAsset in the file retrieval result. This method uses a promise to return the file. 830 * @since 7 831 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 832 * @returns A Promise instance used to return the file in the format of a FileAsset instance. 833 * @deprecated since 9 834 * @useinstead ohos.file.picker 835 */ 836 getLastObject(): Promise<FileAsset>; 837 /** 838 * Obtains the FileAsset with the specified index in the file retrieval result. 839 * This method uses a callback to return the file. 840 * @since 7 841 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 842 * @param index Index of the file to obtain. 843 * @param callback Callback used to return the file in the format of a FileAsset instance. 844 * @deprecated since 9 845 * @useinstead ohos.file.picker 846 */ 847 getPositionObject(index: number, callback: AsyncCallback<FileAsset>): void; 848 /** 849 * Obtains the FileAsset with the specified index in the file retrieval result. 850 * This method uses a promise to return the file. 851 * @since 7 852 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 853 * @param index Index of the file to obtain. 854 * @returns A Promise instance used to return the file in the format of a FileAsset instance. 855 * @deprecated since 9 856 * @useinstead ohos.file.picker 857 */ 858 getPositionObject(index: number): Promise<FileAsset>; 859 /** 860 * Obtains all FileAssets in the file retrieval result. 861 * This method uses a callback to return the result. After this method is called, 862 * close() is automatically called to release the FetchFileResult instance and invalidate it. 863 * In this case, other methods cannot be called. 864 * @since 7 865 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 866 * @param callback Callback used to return a FileAsset array. 867 * @deprecated since 9 868 * @useinstead ohos.file.picker 869 */ 870 getAllObject(callback: AsyncCallback<Array<FileAsset>>): void; 871 /** 872 * Obtains all FileAssets in the file retrieval result. 873 * This method uses a promise to return the result. that store the selected media resources. 874 * close() is automatically called to release the FetchFileResult instance and invalidate it. 875 * In this case, other methods cannot be called. 876 * @since 7 877 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 878 * @returns A Promise instance used to return a FileAsset array. 879 * @deprecated since 9 880 * @useinstead ohos.file.picker 881 */ 882 getAllObject(): Promise<Array<FileAsset>>; 883 } 884 885 /** 886 * Defines the album. 887 * 888 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 889 * @since 7 890 * @deprecated since 9 891 * @useinstead ohos.file.picker 892 */ 893 interface Album { 894 /** 895 * Album ID. 896 * @since 7 897 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 898 * @deprecated since 9 899 * @useinstead ohos.file.picker 900 */ 901 readonly albumId: number; 902 /** 903 * Album name. 904 * @since 7 905 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 906 * @deprecated since 9 907 * @useinstead ohos.file.picker 908 */ 909 albumName: string; 910 /** 911 * Album uri. 912 * @since 8 913 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 914 * @deprecated since 9 915 * @useinstead ohos.file.picker 916 */ 917 readonly albumUri: string; 918 /** 919 * Date (timestamp) when the album was last modified. 920 * @since 7 921 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 922 * @deprecated since 9 923 * @useinstead ohos.file.picker 924 */ 925 readonly dateModified: number; 926 /** 927 * File count for the album 928 * @since 8 929 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 930 * @deprecated since 9 931 * @useinstead ohos.file.picker 932 */ 933 readonly count: number; 934 /** 935 * Relative path for the album 936 * @since 8 937 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 938 * @deprecated since 9 939 * @useinstead ohos.file.picker 940 */ 941 readonly relativePath: string; 942 /** 943 * coverUri for the album 944 * @since 8 945 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 946 * @deprecated since 9 947 * @useinstead ohos.file.picker 948 */ 949 readonly coverUri: string; 950 951 /** 952 * Modify the meta data for the album 953 * @since 8 954 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 955 * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA 956 * @param callback, no value will be returned. 957 * @deprecated since 9 958 * @useinstead ohos.file.picker 959 */ 960 commitModify(callback: AsyncCallback<void>): void; 961 /** 962 * Modify the meta data for the album 963 * @since 8 964 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 965 * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA 966 * @deprecated since 9 967 * @useinstead ohos.file.picker 968 */ 969 commitModify(): Promise<void>; 970 /** 971 * SObtains files in an album. This method uses an asynchronous callback to return the files. 972 * @since 7 973 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 974 * @permission ohos.permission.READ_MEDIA 975 * @param callback Callback used to return the files in the format of a FetchFileResult instance. 976 * @deprecated since 9 977 * @useinstead ohos.file.picker 978 */ 979 getFileAssets(callback: AsyncCallback<FetchFileResult>): void; 980 /** 981 * SObtains files in an album. This method uses an asynchronous callback to return the files. 982 * @since 7 983 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 984 * @permission ohos.permission.READ_MEDIA 985 * @param option Media retrieval options. 986 * @param callback Callback used to return the files in the format of a FetchFileResult instance. 987 * @deprecated since 9 988 * @useinstead ohos.file.picker 989 */ 990 getFileAssets(options: MediaFetchOptions, callback: AsyncCallback<FetchFileResult>): void; 991 /** 992 * Obtains files in an album. This method uses a promise to return the files. 993 * @since 7 994 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 995 * @permission ohos.permission.READ_MEDIA 996 * @param option Media retrieval options. 997 * @returns A Promise instance used to return the files in the format of a FetchFileResult instance. 998 * @deprecated since 9 999 * @useinstead ohos.file.picker 1000 */ 1001 getFileAssets(options?: MediaFetchOptions): Promise<FetchFileResult>; 1002 } 1003 1004 /** 1005 * Enumeration public directory that predefined 1006 * @since 8 1007 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1008 * @deprecated since 9 1009 * @useinstead ohos.file.picker 1010 */ 1011 enum DirectoryType { 1012 /** 1013 * predefined public directory for files token by Camera. 1014 * @since 8 1015 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1016 * @deprecated since 9 1017 * @useinstead ohos.file.picker 1018 */ 1019 DIR_CAMERA = 0, 1020 /** 1021 * predefined public directory for VIDEO files. 1022 * @since 8 1023 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1024 * @deprecated since 9 1025 * @useinstead ohos.file.picker 1026 */ 1027 DIR_VIDEO, 1028 /** 1029 * predefined public directory for IMAGE files. 1030 * @since 8 1031 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1032 * @deprecated since 9 1033 * @useinstead ohos.file.picker 1034 */ 1035 DIR_IMAGE, 1036 /** 1037 * predefined public directory for AUDIO files. 1038 * @since 8 1039 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1040 * @deprecated since 9 1041 * @useinstead ohos.file.picker 1042 */ 1043 DIR_AUDIO, 1044 /** 1045 * predefined public directory for DOCUMENTS files. 1046 * @since 8 1047 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1048 * @deprecated since 9 1049 * @useinstead ohos.file.picker 1050 */ 1051 DIR_DOCUMENTS, 1052 /** 1053 * predefined public directory for DOWNLOAD files. 1054 * @since 8 1055 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1056 * @deprecated since 9 1057 * @useinstead ohos.file.picker 1058 */ 1059 DIR_DOWNLOAD 1060 } 1061 1062 /** 1063 * Defines the MediaLibrary class and provides functions to access the data in media storage. 1064 * 1065 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1066 * @since 6 1067 * @deprecated since 9 1068 * @useinstead ohos.file.picker 1069 */ 1070 interface MediaLibrary { 1071 /** 1072 * get system predefined root dir, use to create file asset by relative path 1073 * @since 8 1074 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1075 * @param type, public directory predefined in DirectoryType. 1076 * @param callback Callback return the FetchFileResult. 1077 * @deprecated since 9 1078 * @useinstead ohos.file.picker 1079 */ 1080 getPublicDirectory(type: DirectoryType, callback: AsyncCallback<string>): void; 1081 /** 1082 * get system predefined root dir, use to create file asset by relative path 1083 * @since 8 1084 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1085 * @param type public directory predefined in DirectoryType. 1086 * @returns A promise instance used to return the public directory in the format of string 1087 * @deprecated since 9 1088 * @useinstead ohos.file.picker 1089 */ 1090 getPublicDirectory(type: DirectoryType): Promise<string>; 1091 /** 1092 * query all assets just for count & first cover 1093 * if need all data, getAllObject from FetchFileResult 1094 * @since 7 1095 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1096 * @permission ohos.permission.READ_MEDIA 1097 * @param options, Media retrieval options. 1098 * @param callback, Callback return the FetchFileResult. 1099 * @deprecated since 9 1100 * @useinstead ohos.file.picker 1101 */ 1102 getFileAssets(options: MediaFetchOptions, callback: AsyncCallback<FetchFileResult>): void; 1103 /** 1104 * query all assets just for count & first cover 1105 * if need all data, getAllObject from FetchFileResult 1106 * @since 7 1107 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1108 * @permission ohos.permission.READ_MEDIA 1109 * @param options Media retrieval options. 1110 * @returns A promise instance used to return the files in the format of a FetchFileResult instance 1111 * @deprecated since 9 1112 * @useinstead ohos.file.picker 1113 */ 1114 getFileAssets(options: MediaFetchOptions): Promise<FetchFileResult>; 1115 /** 1116 * Turn on monitor the data changes by media type 1117 * @since 8 1118 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1119 * @param type one of 'deviceChange','albumChange','imageChange','audioChange','videoChange','fileChange','remoteFileChange' 1120 * @param callback no value returned 1121 * @deprecated since 9 1122 * @useinstead ohos.file.picker 1123 */ 1124 on(type: 'deviceChange' | 'albumChange' | 'imageChange' | 'audioChange' | 'videoChange' | 'fileChange' | 'remoteFileChange', callback: Callback<void>): void; 1125 /** 1126 * Turn off monitor the data changes by media type 1127 * @since 8 1128 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1129 * @param type one of 'deviceChange','albumChange','imageChange','audioChange','videoChange','fileChange','remoteFileChange' 1130 * @param callback no value returned 1131 * @deprecated since 9 1132 * @useinstead ohos.file.picker 1133 */ 1134 off(type: 'deviceChange' | 'albumChange' | 'imageChange' | 'audioChange' | 'videoChange' | 'fileChange' | 'remoteFileChange', callback?: Callback<void>): void; 1135 /** 1136 * Create File Asset 1137 * @since 8 1138 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1139 * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA 1140 * @param mediaType mediaType for example:IMAGE, VIDEO, AUDIO, FILE 1141 * @param displayName file name 1142 * @param relativePath relative path 1143 * @param callback Callback used to return the FileAsset 1144 * @deprecated since 9 1145 * @useinstead ohos.file.picker 1146 */ 1147 createAsset(mediaType: MediaType, displayName: string, relativePath: string, callback: AsyncCallback<FileAsset>): void; 1148 /** 1149 * Create File Asset 1150 * @since 8 1151 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1152 * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA 1153 * @param mediaType mediaType for example:IMAGE, VIDEO, AUDIO, FILE 1154 * @param displayName file name 1155 * @param relativePath relative path 1156 * @returns A Promise instance used to return the FileAsset 1157 * @deprecated since 9 1158 * @useinstead ohos.file.picker 1159 */ 1160 createAsset(mediaType: MediaType, displayName: string, relativePath: string): Promise<FileAsset>; 1161 /** 1162 * Delete File Asset 1163 * @since 8 1164 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1165 * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA 1166 * @param uri FileAsset's URI 1167 * @param callback no value returned 1168 * @systemapi 1169 * @deprecated since 9 1170 * @useinstead ohos.file.picker 1171 */ 1172 deleteAsset(uri: string, callback: AsyncCallback<void>): void; 1173 /** 1174 * Delete File Asset 1175 * @since 8 1176 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1177 * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA 1178 * @param uri, FileAsset's URI 1179 * @returns A Promise instance, no value returned 1180 * @systemapi 1181 * @deprecated since 9 1182 * @useinstead ohos.file.picker 1183 */ 1184 deleteAsset(uri: string): Promise<void>; 1185 /** 1186 * Obtains albums based on the media retrieval options. This method uses an asynchronous callback to return. 1187 * @since 7 1188 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1189 * @permission ohos.permission.READ_MEDIA 1190 * @param option Media retrieval options. 1191 * @param callback Callback used to return an album array. 1192 * @deprecated since 9 1193 * @useinstead ohos.file.picker 1194 */ 1195 getAlbums(options: MediaFetchOptions, callback: AsyncCallback<Array<Album>>): void; 1196 /** 1197 * Obtains albums based on the media retrieval options. This method uses a promise to return the albums. 1198 * @since 7 1199 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1200 * @permission ohos.permission.READ_MEDIA 1201 * @param option Media retrieval options. 1202 * @returns A Promise instance used to return an album array. 1203 * @deprecated since 9 1204 * @useinstead ohos.file.picker 1205 */ 1206 getAlbums(options: MediaFetchOptions): Promise<Array<Album>>; 1207 /** 1208 * Stores media resources. This method uses an asynchronous callback to return the URI that stores 1209 * the media resources. 1210 * @since 6 1211 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1212 * @param option Media resource option. 1213 * @param callback Callback used to return the URI that stores the media resources. 1214 * @deprecated since 9 1215 */ 1216 storeMediaAsset(option: MediaAssetOption, callback: AsyncCallback<string>): void; 1217 /** 1218 * Stores media resources. This method uses a promise to return the URI that stores the media resources. 1219 * @since 6 1220 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1221 * @param option Media resource option. 1222 * @returns Promise used to return the URI that stores the media resources. 1223 * @deprecated since 9 1224 */ 1225 storeMediaAsset(option: MediaAssetOption): Promise<string>; 1226 /** 1227 * Starts image preview, with the first image to preview specified. This method uses an asynchronous callback 1228 * to receive the execution result. 1229 * @since 6 1230 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1231 * @param images List of images to preview. 1232 * @param index Sequence number of the first image to preview. 1233 * @param callback Callback used for image preview. No value is returned. 1234 * @deprecated since 9 1235 */ 1236 startImagePreview(images: Array<string>, index: number, callback: AsyncCallback<void>): void; 1237 /** 1238 * Starts image preview. This method uses an asynchronous callback to receive the execution result. 1239 * @since 6 1240 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1241 * @param images List of images to preview. 1242 * @param callback Callback used for image preview. No value is returned. 1243 * @deprecated since 9 1244 */ 1245 startImagePreview(images: Array<string>, callback: AsyncCallback<void>): void; 1246 /** 1247 * Starts image preview, with the first image to preview specified. 1248 * This method uses a promise to return the execution result. 1249 * @since 6 1250 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1251 * @param images List of images to preview. 1252 * @param index Sequence number of the first image to preview. 1253 * @returns Promise used to return whether the operation is successful. 1254 * @deprecated since 9 1255 */ 1256 startImagePreview(images: Array<string>, index?: number): Promise<void>; 1257 /** 1258 * Starts media selection. This method uses an asynchronous callback to 1259 * return the list of URIs that store the selected media resources. 1260 * @since 6 1261 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1262 * @param option Media selection option. 1263 * @param callback Callback used to return the list of URIs that store the selected media resources. 1264 * @deprecated since 9 1265 */ 1266 startMediaSelect(option: MediaSelectOption, callback: AsyncCallback<Array<string>>): void; 1267 /** 1268 * Starts media selection. This method uses a promise to return the list of URIs 1269 * that store the selected media resources. 1270 * @since 6 1271 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1272 * @param option Media selection option. 1273 * @returns Promise used to return the list of URIs that store the selected media resources. 1274 * @deprecated since 9 1275 */ 1276 startMediaSelect(option: MediaSelectOption): Promise<Array<string>>; 1277 /** 1278 * Get Active Peer device information 1279 * @since 8 1280 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore 1281 * @permission ohos.permission.READ_MEDIA 1282 * @systemapi 1283 * @param callback, Callback return the list of the active peer devices' information 1284 * @deprecated since 9 1285 * @useinstead ohos.file.picker 1286 */ 1287 getActivePeers(callback: AsyncCallback<Array<PeerInfo>>): void; 1288 /** 1289 * Get Active Peer device information 1290 * @since 8 1291 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore 1292 * @permission ohos.permission.READ_MEDIA 1293 * @systemapi 1294 * @returns Promise used to return the list of the active peer devices' information 1295 * @deprecated since 9 1296 * @useinstead ohos.file.picker 1297 */ 1298 getActivePeers(): Promise<Array<PeerInfo>>; 1299 /** 1300 * Get all the peer devices' information 1301 * @since 8 1302 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore 1303 * @permission ohos.permission.READ_MEDIA 1304 * @systemapi 1305 * @param callback Callback return the list of the all the peer devices' information 1306 * @deprecated since 9 1307 * @useinstead ohos.file.picker 1308 */ 1309 getAllPeers(callback: AsyncCallback<Array<PeerInfo>>): void; 1310 /** 1311 * Get all the peer devices' information 1312 * @since 8 1313 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore 1314 * @permission ohos.permission.READ_MEDIA 1315 * @systemapi 1316 * @returns Promise used to return the list of the all the peer devices' information 1317 * @deprecated since 9 1318 * @useinstead ohos.file.picker 1319 */ 1320 getAllPeers(): Promise<Array<PeerInfo>>; 1321 /** 1322 * Release MediaLibrary instance 1323 * @since 8 1324 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1325 * @param callback no value returned 1326 * @deprecated since 9 1327 * @useinstead ohos.file.picker 1328 */ 1329 release(callback: AsyncCallback<void>): void; 1330 /** 1331 * Release MediaLibrary instance 1332 * @since 8 1333 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1334 * @deprecated since 9 1335 * @useinstead ohos.file.picker 1336 */ 1337 release(): Promise<void>; 1338 } 1339 1340 /** 1341 * thumbnail's size which have width and height 1342 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1343 * @since 8 1344 * @deprecated since 9 1345 * @useinstead ohos.file.picker 1346 */ 1347 interface Size { 1348 /** 1349 * Width of image file 1350 * @since 8 1351 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1352 * @deprecated since 9 1353 * @useinstead ohos.file.picker 1354 */ 1355 width: number; 1356 /** 1357 * Height of image file 1358 * @since 8 1359 * @syscap SystemCapability.Multimedia.MediaLibrary.Core 1360 * @deprecated since 9 1361 * @useinstead ohos.file.picker 1362 */ 1363 height: number; 1364 } 1365 1366 /** 1367 * peer devices' information 1368 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore 1369 * @systemapi 1370 * @since 8 1371 * @deprecated since 9 1372 * @useinstead ohos.file.picker 1373 */ 1374 interface PeerInfo { 1375 /** 1376 * Peer device name 1377 * @since 8 1378 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore 1379 * @systemapi 1380 * @deprecated since 9 1381 * @useinstead ohos.file.picker 1382 */ 1383 readonly deviceName: string; 1384 /** 1385 * Peer device network id 1386 * @since 8 1387 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore 1388 * @systemapi 1389 * @deprecated since 9 1390 * @useinstead ohos.file.picker 1391 */ 1392 readonly networkId: string; 1393 /** 1394 * Peer device type 1395 * @since 8 1396 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore 1397 * @systemapi 1398 * @deprecated since 9 1399 * @useinstead ohos.file.picker 1400 */ 1401 readonly deviceType: DeviceType; 1402 /** 1403 * Peer device online status 1404 * @since 8 1405 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore 1406 * @systemapi 1407 * @deprecated since 9 1408 * @useinstead ohos.file.picker 1409 */ 1410 readonly isOnline: boolean; 1411 } 1412 1413 /** 1414 * peer device type 1415 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore 1416 * @systemapi 1417 * @since 8 1418 * @deprecated since 9 1419 * @useinstead ohos.file.picker 1420 */ 1421 enum DeviceType { 1422 /** 1423 * Unknown device type 1424 * @since 8 1425 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore 1426 * @systemapi 1427 * @deprecated since 9 1428 * @useinstead ohos.file.picker 1429 */ 1430 TYPE_UNKNOWN = 0, 1431 /** 1432 * Laptop device 1433 * @since 8 1434 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore 1435 * @systemapi 1436 * @deprecated since 9 1437 * @useinstead ohos.file.picker 1438 */ 1439 TYPE_LAPTOP, 1440 /** 1441 * Phone device 1442 * @since 8 1443 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore 1444 * @systemapi 1445 * @deprecated since 9 1446 * @useinstead ohos.file.picker 1447 */ 1448 TYPE_PHONE, 1449 /** 1450 * Tablet device 1451 * @since 8 1452 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore 1453 * @systemapi 1454 * @deprecated since 9 1455 * @useinstead ohos.file.picker 1456 */ 1457 TYPE_TABLET, 1458 /** 1459 * Watch device 1460 * @since 8 1461 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore 1462 * @systemapi 1463 * @deprecated since 9 1464 * @useinstead ohos.file.picker 1465 */ 1466 TYPE_WATCH, 1467 /** 1468 * Car device 1469 * @since 8 1470 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore 1471 * @systemapi 1472 * @deprecated since 9 1473 * @useinstead ohos.file.picker 1474 */ 1475 TYPE_CAR, 1476 /** 1477 * TV device 1478 * @since 8 1479 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore 1480 * @systemapi 1481 * @deprecated since 9 1482 * @useinstead ohos.file.picker 1483 */ 1484 TYPE_TV 1485 } 1486} 1487 1488export default mediaLibrary;