• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
16import { AsyncCallback } from './basic';
17import { WantAgent } from './@ohos.wantAgent';
18import { KeyEvent } from './@ohos.multimodalInput.keyEvent';
19import { ElementName } from './bundleManager/ElementName';
20import image from './@ohos.multimedia.image';
21import audio from './@ohos.multimedia.audio';
22
23/**
24 * @name avSession
25 * @syscap SystemCapability.Multimedia.AVSession.Core
26 * @since 9
27 */
28declare namespace avSession {
29  /**
30   * Create an AVSession instance. An ability can only create one AVSession
31   * @param context The context of application
32   * @param tag A user-defined name for this session
33   * @param type The type of session {@link AVSessionType}
34   * @param {AsyncCallback<AVSession>} [callback] - callback.
35   * @returns {void | Promise<AVSession>} no callback returns Promise otherwise returns void
36   * @throws {BusinessError} 401 - parameter check failed
37   * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
38   * @syscap SystemCapability.Multimedia.AVSession.Core
39   * @systemapi
40   * @since 9
41   */
42  function createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback<AVSession>): void;
43  function createAVSession(context: Context, tag: string, type: AVSessionType): Promise<AVSession>;
44
45  /**
46   * Get all avsession descriptors of the system
47   * @permission ohos.permission.MANAGE_MEDIA_RESOURCES
48   * @returns The array of {@link AVSessionDescriptor}
49   * @throws {BusinessError} 201 - permission denied
50   * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
51   * @syscap SystemCapability.Multimedia.AVSession.Manager
52   * @systemapi
53   * @since 9
54   */
55  function getAllSessionDescriptors(callback: AsyncCallback<Array<Readonly<AVSessionDescriptor>>>): void;
56  function getAllSessionDescriptors(): Promise<Array<Readonly<AVSessionDescriptor>>>;
57
58  /**
59   * Create an avsession controller
60   * @permission ohos.permission.MANAGE_MEDIA_RESOURCES
61   * @param sessionId Specifies the sessionId to create the controller.
62   * If provided 'default', the system will create a default controller, Used to control the system default session
63   * @returns An instance of {@link AVSessionController}
64   * @throws {BusinessError} 201 - permission denied
65   * @throws {BusinessError} 401 - parameter check failed
66   * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
67   * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
68   * @syscap SystemCapability.Multimedia.AVSession.Manager
69   * @systemapi
70   * @since 9
71   */
72  function createController(sessionId: string, callback: AsyncCallback<AVSessionController>): void;
73  function createController(sessionId: string): Promise<AVSessionController>;
74
75  /**
76   * Cast Audio to the remote devices or cast back local device
77   * @permission ohos.permission.MANAGE_MEDIA_RESOURCES
78   * @param audioDevices Specifies the audio devices to cast.
79   * @param sessionId Specifies the sessionId which to send to remote.
80   * 'all' means cast all the media audio of this device to remote.
81   * @throws {BusinessError} 201 - permission denied
82   * @throws {BusinessError} 401 - parameter check failed
83   * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
84   * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
85   * @throws {BusinessError} {@link #ERR_CODE_REMOTE_CONNECTION_ERR} - remote connection error
86   * @syscap SystemCapability.Multimedia.AVSession.Manager
87   * @systemapi
88   * @since 9
89   */
90  function castAudio(session: SessionToken | 'all', audioDevices: Array<audio.AudioDeviceDescriptor>, callback: AsyncCallback<void>): void;
91  function castAudio(session: SessionToken | 'all', audioDevices: Array<audio.AudioDeviceDescriptor>): Promise<void>;
92
93  /**
94   * Session token. Used to judge the legitimacy of the session.
95   * @permission ohos.permission.MANAGE_MEDIA_RESOURCES
96   * @syscap SystemCapability.Multimedia.AVSession.Manager
97   * @systemapi
98   * @since 9
99   */
100  interface SessionToken {
101    /**
102     * The unique session id of the avsession object
103     * @since 9
104     */
105    sessionId: string;
106    /**
107     * Process id of session
108     * @since 9
109     */
110    pid: number;
111    /**
112     * User id
113     * @since 9
114     */
115    uid: number;
116  }
117
118  /**
119   * Register system session changed callback
120   * @permission ohos.permission.MANAGE_MEDIA_RESOURCES
121   * @param type Registration Type, session creation, deletion or top priority session changed
122   * @param callback Used to returns the descriptor of created or delete session
123   * @throws {BusinessError} 201 - permission denied
124   * @throws {BusinessError} 401 - parameter check failed
125   * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
126   * @syscap SystemCapability.Multimedia.AVSession.Manager
127   * @systemapi
128   * @since 9
129   */
130  function on(type: 'sessionCreate' | 'sessionDestroy' | 'topSessionChange', callback: (session: AVSessionDescriptor) => void): void;
131
132  /**
133   * Unregister system session changed callback
134   * @permission ohos.permission.MANAGE_MEDIA_RESOURCES
135   * @param type Registration Type, session creation, deletion or top priority session changed
136   * @param callback Used to returns the descriptor of created or delete session
137   * @throws {BusinessError} 201 - permission denied
138   * @throws {BusinessError} 401 - parameter check failed
139   * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
140   * @syscap SystemCapability.Multimedia.AVSession.Manager
141   * @systemapi
142   * @since 9
143   */
144  function off(type: 'sessionCreate' | 'sessionDestroy' | 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;
145
146  /**
147   * Register Session service death callback, notifying the application to clean up resources.
148   * @param type Registration Type
149   * @param callback Used to handle the session service death event.
150   * @throws {BusinessError} 201 - permission denied
151   * @throws {BusinessError} 401 - parameter check failed
152   * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
153   * @syscap SystemCapability.Multimedia.AVSession.Core
154   * @systemapi
155   * @since 9
156   */
157  function on(type: 'sessionServiceDie', callback: () => void): void;
158
159  /**
160   * Unregister Session service death callback, notifying the application to clean up resources.
161   * @param type Registration Type
162   * @param callback Used to handle the session service death event.
163   * @throws {BusinessError} 201 - permission denied
164   * @throws {BusinessError} 401 - parameter check failed
165   * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
166   * @syscap SystemCapability.Multimedia.AVSession.Core
167   * @systemapi
168   * @since 9
169   */
170  function off(type: 'sessionServiceDie', callback?: () => void): void;
171
172  /**
173   * Send system media key event.The system automatically selects the recipient.
174   * @permission ohos.permission.MANAGE_MEDIA_RESOURCES
175   * @param event The key event to be send
176   * @throws {BusinessError} 201 - permission denied
177   * @throws {BusinessError} 401 - parameter check failed
178   * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
179   * @throws {BusinessError} {@link #ERR_CODE_COMMAND_INVALID} - command not supported
180   * @syscap SystemCapability.Multimedia.AVSession.Manager
181   * @systemapi
182   * @since 9
183   */
184  function sendSystemAVKeyEvent(event: KeyEvent, callback: AsyncCallback<void>): void;
185  function sendSystemAVKeyEvent(event: KeyEvent): Promise<void>;
186
187  /**
188   * Send system control command.The system automatically selects the recipient.
189   * @permission ohos.permission.MANAGE_MEDIA_RESOURCES
190   * @param command The command to be send. See {@link AVControlCommand}
191   * @throws {BusinessError} 201 - permission denied
192   * @throws {BusinessError} 401 - parameter check failed
193   * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
194   * @throws {BusinessError} {@link #ERR_CODE_COMMAND_INVALID} - command not supported
195   * @throws {BusinessError} {@link #ERR_CODE_MESSAGE_OVERLOAD} - command or event overload
196   * @syscap SystemCapability.Multimedia.AVSession.Manager
197   * @systemapi
198   * @since 9
199   */
200  function sendSystemControlCommand(command: AVControlCommand, callback: AsyncCallback<void>): void;
201  function sendSystemControlCommand(command: AVControlCommand): Promise<void>;
202
203  /**
204   * session type.
205   * @syscap SystemCapability.Multimedia.AVSession.Core
206   * @systemapi
207   * @since 9
208   */
209  type AVSessionType = 'audio' | 'video';
210  /**
211   * AVSession object.
212   * @interface AVSession
213   * @syscap SystemCapability.Multimedia.AVSession.Core
214   * @systemapi
215   * @since 9
216   */
217  interface AVSession {
218    /**
219     * unique session Id
220     * @syscap SystemCapability.Multimedia.AVSession.Core
221     * @systemapi
222     * @since 9
223     */
224    readonly sessionId: string;
225
226    /**
227     * Set the metadata of this session.
228     * In addition to the required properties, users can fill in partially supported properties
229     * @param data {@link AVMetadata}
230     * @throws {BusinessError} 401 - parameter check failed
231     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
232     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
233     * @syscap SystemCapability.Multimedia.AVSession.Core
234     * @systemapi
235     * @since 9
236     */
237    setAVMetadata(data: AVMetadata, callback: AsyncCallback<void>): void;
238    setAVMetadata(data: AVMetadata): Promise<void>;
239
240    /**
241     * Set the playback state of this session.
242     * @param state {@link AVPlaybackState}
243     * @throws {BusinessError} 401 - parameter check failed
244     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
245     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
246     * @syscap SystemCapability.Multimedia.AVSession.Core
247     * @systemapi
248     * @since 9
249     */
250    setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback<void>): void;
251    setAVPlaybackState(state: AVPlaybackState): Promise<void>;
252
253    /**
254     * Set the ability to start the session corresponding to
255     * @param ability The WantAgent for launch the ability
256     * @since 9
257     * @syscap SystemCapability.Multimedia.AVSession.Core
258     * @systemapi
259     * @throws {BusinessError} 401 - parameter check failed
260     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
261     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
262     */
263    setLaunchAbility(ability: WantAgent, callback: AsyncCallback<void>): void;
264    setLaunchAbility(ability: WantAgent): Promise<void>;
265
266    /**
267     * Get the current session's own controller
268     * @returns The instance of {@link AVSessionController}
269     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
270     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
271     * @syscap SystemCapability.Multimedia.AVSession.Core
272     * @systemapi
273     * @since 9
274     */
275    getController(callback: AsyncCallback<AVSessionController>): void;
276    getController(): Promise<AVSessionController>;
277
278    /**
279     * Get output device information
280     * @returns The instance of {@link OutputDeviceInfo}
281     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
282     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
283     * @syscap SystemCapability.Multimedia.AVSession.Core
284     * @systemapi
285     * @since 9
286     */
287    getOutputDevice(callback: AsyncCallback<OutputDeviceInfo>): void;
288    getOutputDevice(): Promise<OutputDeviceInfo>;
289
290    /**
291     * Register or unregister playback command callback.
292     * As long as it is registered, it means that the ability supports this command.
293     * If you cancel the callback, you need to call off {@link off}
294     * When canceling the callback, need to update the supported commands list.
295     * Each playback command only supports registering one callback,
296     * and the new callback will replace the previous one.
297     * @param type Command to register.
298     * @param callback Used to handle callback commands
299     * @throws {BusinessError} 401 - parameter check failed
300     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
301     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
302     * @syscap SystemCapability.Multimedia.AVSession.Core
303     * @systemapi
304     * @since 9
305     */
306    on(type: 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind', callback: () => void): void;
307
308    /**
309     * Unregister playback command callback.
310     * When canceling the callback, need to update the supported commands list.
311     * @param type Command to register.
312     * @param callback Used to handle callback commands
313     * @throws {BusinessError} 401 - parameter check failed
314     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
315     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
316     * @syscap SystemCapability.Multimedia.AVSession.Core
317     * @systemapi
318     * @since 9
319     */
320    off(type: 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind', callback?: () => void): void;
321
322    /**
323     * Register seek command callback
324     * @param type Registration Type 'seek'
325     * @param callback Used to handle seek command.The callback provide the seek time(ms)
326     * @throws {BusinessError} 401 - parameter check failed
327     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
328     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
329     * @syscap SystemCapability.Multimedia.AVSession.Core
330     * @systemapi
331     * @since 9
332     */
333    on(type: 'seek', callback: (time: number) => void): void;
334
335    /**
336     * Unregister seek command callback
337     * @param type Registration Type 'seek'
338     * @param callback Used to handle seek command.The callback provide the seek time(ms)
339     * @throws {BusinessError} 401 - parameter check failed
340     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
341     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
342     * @syscap SystemCapability.Multimedia.AVSession.Core
343     * @systemapi
344     * @since 9
345     */
346    off(type: 'seek', callback?: (time: number) => void): void;
347
348    /**
349     * Register setSpeed command callback
350     * @param type Registration Type 'setSpeed'
351     * @param callback Used to handle setSpeed command.The callback provide the speed value
352     * @throws {BusinessError} 401 - parameter check failed
353     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
354     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
355     * @syscap SystemCapability.Multimedia.AVSession.Core
356     * @systemapi
357     * @since 9
358     */
359    on(type: 'setSpeed', callback: (speed: number) => void): void;
360
361    /**
362     * Unregister setSpeed command callback
363     * @param type Registration Type 'setSpeed'
364     * @param callback Used to handle setSpeed command.The callback provide the speed value
365     * @throws {BusinessError} 401 - parameter check failed
366     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
367     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
368     * @syscap SystemCapability.Multimedia.AVSession.Core
369     * @systemapi
370     * @since 9
371     */
372    off(type: 'setSpeed', callback?: (speed: number) => void): void;
373
374    /**
375     * Register setLoopMode command callback
376     * @param type Registration Type 'setLoopMode'
377     * @param callback Used to handle setLoopMode command.The callback provide the {@link LoopMode}
378     * @throws {BusinessError} 401 - parameter check failed
379     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
380     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
381     * @syscap SystemCapability.Multimedia.AVSession.Core
382     * @systemapi
383     * @since 9
384     */
385    on(type: 'setLoopMode', callback: (mode: LoopMode) => void): void;
386
387    /**
388     * Unregister setLoopMode command callback
389     * @param type Registration Type 'setLoopMode'
390     * @param callback Used to handle setLoopMode command.The callback provide the {@link LoopMode}
391     * @throws {BusinessError} 401 - parameter check failed
392     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
393     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
394     * @syscap SystemCapability.Multimedia.AVSession.Core
395     * @systemapi
396     * @since 9
397     */
398    off(type: 'setLoopMode', callback?: (mode: LoopMode) => void): void;
399
400    /**
401     * Register toggle favorite command callback
402     * @param type Registration Type 'toggleFavorite'
403     * @param callback Used to handle toggleFavorite command.The callback provide
404     * the assetId for which the favorite status needs to be switched.
405     * @throws {BusinessError} 401 - parameter check failed
406     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
407     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
408     * @syscap SystemCapability.Multimedia.AVSession.Core
409     * @systemapi
410     * @since 9
411     */
412    on(type: 'toggleFavorite', callback: (assetId: string) => void): void;
413
414    /**
415     * Unregister toggle favorite command callback
416     * @param type Registration Type 'toggleFavorite'
417     * @param callback Used to handle toggleFavorite command.The callback provide
418     * the assetId for which the favorite status needs to be switched.
419     * @throws {BusinessError} 401 - parameter check failed
420     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
421     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
422     * @syscap SystemCapability.Multimedia.AVSession.Core
423     * @systemapi
424     * @since 9
425     */
426    off(type: 'toggleFavorite', callback?: (assetId: string) => void): void;
427
428    /**
429     * Register media key handling callback
430     * @param type Registration Type
431     * @param callback Used to handle key events.The callback provide the KeyEvent
432     * @throws {BusinessError} 401 - parameter check failed
433     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
434     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
435     * @syscap SystemCapability.Multimedia.AVSession.Core
436     * @systemapi
437     * @since 9
438     */
439    on(type: 'handleKeyEvent', callback: (event: KeyEvent) => void): void;
440
441    /**
442     * Unregister media key handling callback
443     * @param type Registration Type
444     * @param callback Used to handle key events.The callback provide the KeyEvent
445     * @throws {BusinessError} 401 - parameter check failed
446     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
447     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
448     * @syscap SystemCapability.Multimedia.AVSession.Core
449     * @systemapi
450     * @since 9
451     */
452    off(type: 'handleKeyEvent', callback?: (event: KeyEvent) => void): void;
453
454    /**
455     * Register session output device change callback
456     * @param type Registration Type
457     * @param callback Used to handle output device changed.
458     * The callback provide the new device info {@link OutputDeviceInfo}
459     * @throws {BusinessError} 401 - parameter check failed
460     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
461     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
462     * @syscap SystemCapability.Multimedia.AVSession.Core
463     * @systemapi
464     * @since 9
465     */
466    on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): void;
467
468    /**
469     * Unregister session output device change callback
470     * @param type Registration Type
471     * @param callback Used to handle output device changed.
472     * The callback provide the new device info {@link OutputDeviceInfo}
473     * @throws {BusinessError} 401 - parameter check failed
474     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
475     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
476     * @syscap SystemCapability.Multimedia.AVSession.Core
477     * @systemapi
478     * @since 9
479     */
480    off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): void;
481
482    /**
483     * Activate the session, indicating that the session can accept control commands
484     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
485     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
486     * @syscap SystemCapability.Multimedia.AVSession.Core
487     * @systemapi
488     * @since 9
489     */
490    activate(callback: AsyncCallback<void>): void;
491    activate(): Promise<void>;
492
493    /**
494     * Deactivate the session, indicating that the session not ready to accept control commands
495     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
496     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
497     * @syscap SystemCapability.Multimedia.AVSession.Core
498     * @systemapi
499     * @since 9
500     */
501    deactivate(callback: AsyncCallback<void>): void;
502    deactivate(): Promise<void>;
503
504    /**
505     * Destroy this session, the server will clean up the session resources
506     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
507     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
508     * @syscap SystemCapability.Multimedia.AVSession.Core
509     * @systemapi
510     * @since 9
511     */
512    destroy(callback: AsyncCallback<void>): void;
513    destroy(): Promise<void>;
514  }
515
516  /**
517   * The metadata of the current media.Used to set the properties of the current media file
518   * @interface AVMetadata
519   * @syscap SystemCapability.Multimedia.AVSession.Core
520   * @systemapi
521   * @since 9
522   */
523  interface AVMetadata {
524    /**
525     * Unique ID used to represent this media.
526     * @syscap SystemCapability.Multimedia.AVSession.Core
527     * @since 9
528     */
529    assetId: string;
530    /**
531     * The title of this media, for display in media center.
532     * @syscap SystemCapability.Multimedia.AVSession.Core
533     * @since 9
534     */
535    title?: string;
536    /**
537     * The artist of this media
538     * @syscap SystemCapability.Multimedia.AVSession.Core
539     * @since 9
540     */
541    artist?: string;
542    /**
543     * The author of this media
544     * @syscap SystemCapability.Multimedia.AVSession.Core
545     * @since 9
546     */
547    author?: string;
548    /**
549     * The album of this media
550     * @syscap SystemCapability.Multimedia.AVSession.Core
551     * @since 9
552     */
553    album?: string;
554    /**
555     * The writer of this media
556     * @syscap SystemCapability.Multimedia.AVSession.Core
557     * @since 9
558     */
559    writer?: string;
560    /**
561     * The composer of this media
562     * @syscap SystemCapability.Multimedia.AVSession.Core
563     * @since 9
564     */
565    composer?: string;
566    /**
567     * The duration of this media, used to automatically calculate playback position
568     * @syscap SystemCapability.Multimedia.AVSession.Core
569     * @since 9
570     */
571    duration?: number;
572    /**
573     * The image of the media as a {@link PixelMap} or an uri formatted String,
574     * used to display in media center.
575     * @syscap SystemCapability.Multimedia.AVSession.Core
576     * @since 9
577     */
578    mediaImage?: image.PixelMap | string;
579    /**
580     * The publishDate of the media
581     * @syscap SystemCapability.Multimedia.AVSession.Core
582     * @since 9
583     */
584    publishDate?: Date;
585    /**
586     * The subtitle of the media, used for display
587     * @syscap SystemCapability.Multimedia.AVSession.Core
588     * @since 9
589     */
590    subtitle?: string;
591    /**
592     * The discription of the media, used for display
593     * @syscap SystemCapability.Multimedia.AVSession.Core
594     * @since 9
595     */
596    description?: string;
597    /**
598     * The lyric of the media, it should be in standard lyric format
599     * @syscap SystemCapability.Multimedia.AVSession.Core
600     * @since 9
601     */
602    lyric?: string;
603    /**
604     * The previous playable media id.
605     * Used to tell the controller if there is a previous playable media
606     * @syscap SystemCapability.Multimedia.AVSession.Core
607     * @since 9
608     */
609    previousAssetId?: string;
610    /**
611     * The next playable media id.
612     * Used to tell the controller if there is a next playable media
613     * @syscap SystemCapability.Multimedia.AVSession.Core
614     * @since 9
615     */
616    nextAssetId?: string;
617  }
618
619  /**
620   * Used to indicate the playback state of the current media.
621   * If the playback state of the media changes, it needs to be updated synchronously
622   * @interface AVPlaybackState
623   * @syscap SystemCapability.Multimedia.AVSession.Core
624   * @systemapi
625   * @since 9
626   */
627  interface AVPlaybackState {
628    /**
629     * Current playback state. See {@link PlaybackState}
630     * @syscap SystemCapability.Multimedia.AVSession.Core
631     * @since 9
632     */
633    state?: PlaybackState;
634    /**
635     * Current playback speed
636     * @syscap SystemCapability.Multimedia.AVSession.Core
637     * @since 9
638     */
639    speed?: number;
640    /**
641     * Current playback position of this media. See {@link PlaybackPosition}
642     * @syscap SystemCapability.Multimedia.AVSession.Core
643     * @since 9
644     */
645    position?: PlaybackPosition;
646    /**
647     * The current buffered time, the maximum playable position
648     * @syscap SystemCapability.Multimedia.AVSession.Core
649     * @since 9
650     */
651    bufferedTime?: number;
652    /**
653     * Current playback loop mode. See {@link LoopMode}
654     * @syscap SystemCapability.Multimedia.AVSession.Core
655     * @since 9
656     */
657    loopMode?: LoopMode;
658    /**
659     * Current Favorite Status
660     * @syscap SystemCapability.Multimedia.AVSession.Core
661     * @since 9
662     */
663    isFavorite?: boolean;
664  }
665
666  /**
667   * Playback position definition
668   * @interface PlaybackPosition
669   * @syscap SystemCapability.Multimedia.AVSession.Core
670   * @systemapi
671   * @since 9
672   */
673  interface PlaybackPosition {
674    /**
675     * Elapsed time(position) of this media set by the app.
676     * @syscap SystemCapability.Multimedia.AVSession.Core
677     * @since 9
678     */
679    elapsedTime: number;
680    /**
681     * Record the system time when elapsedTime is set.
682     * @syscap SystemCapability.Multimedia.AVSession.Core
683     * @since 9
684     */
685    updateTime: number;
686  }
687  /**
688   * Target Device Information Definition
689   * @interface OutputDeviceInfo
690   * @syscap SystemCapability.Multimedia.AVSession.Core
691   * @systemapi
692   * @since 9
693   */
694  interface OutputDeviceInfo {
695    /**
696     * Whether the remote device
697     * @since 9
698     */
699    isRemote: boolean;
700    /**
701     * Audio device id.The length of the audioDeviceId array is greater than 1
702     * if output to multiple devices at the same time.
703     * @since 9
704     */
705    audioDeviceId: Array<number>;
706    /**
707     * Device name. The length of the deviceName array is greater than 1
708     * if output to multiple devices at the same time.
709     * @since 9
710     */
711    deviceName: Array<string>;
712  }
713  /**
714   * Loop Play Mode Definition
715   * @enum {number}
716   * @syscap SystemCapability.Multimedia.AVSession.Core
717   * @systemapi
718   * @since 9
719   */
720  enum LoopMode {
721    /**
722     * The default mode is sequential playback
723     * @since 9
724     */
725    LOOP_MODE_SEQUENCE = 0,
726
727    /**
728     * Single loop mode
729     * @since 9
730     */
731    LOOP_MODE_SINGLE = 1,
732
733    /**
734     * List loop mode
735     * @since 9
736     */
737    LOOP_MODE_LIST = 2,
738
739    /**
740     * Shuffle playback mode
741     * @since 9
742     */
743    LOOP_MODE_SHUFFLE = 3,
744  }
745
746  /**
747   * Definition of current playback state
748   * @enum {number}
749   * @syscap SystemCapability.Multimedia.AVSession.Core
750   * @systemapi
751   * @since 9
752   */
753  enum PlaybackState {
754    /**
755     * Initial state. The initial state of media file
756     * @since 9
757     */
758    PLAYBACK_STATE_INITIAL = 0,
759
760    /**
761     * Preparing state. Indicates that the media file is not ready to play,
762     * the media is loading or buffering
763     * @since 9
764     */
765    PLAYBACK_STATE_PREPARE = 1,
766
767    /**
768     * Playing state.
769     * @since 9
770     */
771    PLAYBACK_STATE_PLAY = 2,
772
773    /**
774     * Paused state.
775     * @since 9
776     */
777    PLAYBACK_STATE_PAUSE = 3,
778
779    /**
780     * Fast forwarding state.
781     * @since 9
782     */
783    PLAYBACK_STATE_FAST_FORWARD = 4,
784
785    /**
786     * Rewinding state.
787     * @since 9
788     */
789    PLAYBACK_STATE_REWIND = 5,
790
791    /**
792     * Stopped state.The server will clear the media playback position and other information.
793     * @since 9
794     */
795    PLAYBACK_STATE_STOP = 6,
796  }
797
798  /**
799   * The description of the session
800   * @interface AVSessionDescriptor
801   * @syscap SystemCapability.Multimedia.AVSession.Manager
802   * @systemapi
803   * @since 9
804   */
805  interface AVSessionDescriptor {
806    /**
807     * Unique ID of the session
808     * @since 9
809     */
810    sessionId: string;
811    /**
812     * Session type, currently supports audio or video
813     * @since 9
814     */
815    type: AVSessionType;
816    /**
817     * The session tag set by the application
818     * @since 9
819     */
820    sessionTag: string;
821    /**
822     * The elementName of the ability that created this session. See {@link ElementName} in bundle/elementName.d.ts
823     * @since 9
824     */
825    elementName: ElementName;
826    /**
827     * Session active state
828     * @since 9
829     */
830    isActive: boolean;
831    /**
832     * Is it the top priority session
833     * @since 9
834     */
835    isTopSession: boolean;
836    /**
837     * The current output device information.
838     * It will be undefined if this is a local session.
839     * @since 9
840     */
841    outputDevice: OutputDeviceInfo;
842  }
843
844  /**
845   * Session controller,used to control media playback and get media information
846   * @interface AVSessionController
847   * @syscap SystemCapability.Multimedia.AVSession.Core
848   * @systemapi
849   * @since 9
850   */
851  interface AVSessionController {
852    /**
853     * Unique session Id
854     * @syscap SystemCapability.Multimedia.AVSession.Core
855     * @systemapi
856     * @since 9
857     */
858    readonly sessionId: string;
859    /**
860     * Get the playback status of the current session
861     * @returns AVPlaybackState {@link AVPlaybackState}
862     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
863     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
864     * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist
865     * @systemapi
866     * @since 9
867     */
868    getAVPlaybackState(callback: AsyncCallback<AVPlaybackState>): void;
869    getAVPlaybackState(): Promise<AVPlaybackState>;
870
871    /**
872     * Get the metadata of the current session
873     * @returns AVMetadata {@link AVMetadata}
874     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
875     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
876     * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist
877     * @systemapi
878     * @since 9
879     */
880    getAVMetadata(callback: AsyncCallback<AVMetadata>): void;
881    getAVMetadata(): Promise<AVMetadata>;
882
883    /**
884     * Get output device information
885     * @returns The instance of {@link OutputDeviceInfo}
886     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
887     * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist
888     * @syscap SystemCapability.Multimedia.AVSession.Core
889     * @systemapi
890     * @since 9
891     */
892    getOutputDevice(callback: AsyncCallback<OutputDeviceInfo>): void;
893    getOutputDevice(): Promise<OutputDeviceInfo>;
894
895    /**
896     * Send media key event to this session
897     * @param event The KeyEvent
898     * @throws {BusinessError} 401 - parameter check failed
899     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
900     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
901     * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist
902     * @throws {BusinessError} {@link #ERR_CODE_COMMAND_INVALID} - command not supported
903     * @throws {BusinessError} {@link #ERR_CODE_SESSION_INACTIVE} - session inactive
904     * @systemapi
905     * @since 9
906     */
907    sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback<void>): void;
908    sendAVKeyEvent(event: KeyEvent): Promise<void>;
909
910    /**
911     * Get the {@link WantAgent} of this session that can launch the session ability
912     * @returns WantAgent {@link WantAgent}
913     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
914     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
915     * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist
916     * @systemapi
917     * @since 9
918     */
919    getLaunchAbility(callback: AsyncCallback<WantAgent>): void;
920    getLaunchAbility(): Promise<WantAgent>;
921
922    /**
923     * Get the adjusted playback position. The time automatically calculated by the system
924     * taking into account factors such as playback status, playback speed, and application update time.
925     * @returns current playback position in ms.Note that the returns value of each call will be different.
926     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
927     * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist
928     * @systemapi
929     * @since 9
930     */
931    getRealPlaybackPositionSync(): number;
932
933    /**
934     * Check if the current session is active
935     * @returns the active state
936     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
937     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
938     * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist
939     * @systemapi
940     * @since 9
941     */
942    isActive(callback: AsyncCallback<boolean>): void;
943    isActive(): Promise<boolean>;
944
945    /**
946     * Destroy the server controller
947     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
948     * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist
949     * @systemapi
950     * @since 9
951     */
952    destroy(callback: AsyncCallback<void>): void;
953    destroy(): Promise<void>;
954
955    /**
956     * Get commands supported by the current session
957     * @returns An array of AVControlCommandType {@link AVControlCommandType}
958     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
959     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
960     * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist
961     * @systemapi
962     * @since 9
963     */
964    getValidCommands(callback: AsyncCallback<Array<AVControlCommandType>>): void;
965    getValidCommands(): Promise<Array<AVControlCommandType>>;
966
967    /**
968     * Send control commands to this session
969     * @param command The command to be send. See {@link AVControlCommand}
970     * @throws {BusinessError} 401 - parameter check failed
971     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
972     * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist
973     * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist
974     * @throws {BusinessError} {@link #ERR_CODE_COMMAND_INVALID} - command not supported
975     * @throws {BusinessError} {@link #ERR_CODE_SESSION_INACTIVE} - session inactive
976     * @throws {BusinessError} {@link #ERR_CODE_MESSAGE_OVERLOAD} - command or event overload
977     * @systemapi
978     * @since 9
979     */
980    sendControlCommand(command: AVControlCommand, callback: AsyncCallback<void>): void;
981    sendControlCommand(command: AVControlCommand): Promise<void>;
982
983    /**
984     * Register metadata changed callback
985     * @param type 'metadataChange'
986     * @param filter The properties of {@link AVMetadata} that you cared about
987     * @param callback The callback used to handle metadata changed event.
988     * The callback function provides the {@link AVMetadata} parameter.
989     * It only contains the properties set in the filter.
990     * @throws {BusinessError} 401 - parameter check failed
991     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
992     * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist
993     * @systemapi
994     * @since 9
995     */
996    on(type: 'metadataChange', filter: Array<keyof AVMetadata> | 'all', callback: (data: AVMetadata) => void);
997
998    /**
999     * Unregister metadata changed callback
1000     * @param type 'metadataChange'
1001     * @param filter The properties of {@link AVMetadata} that you cared about
1002     * @param callback The callback used to handle metadata changed event.
1003     * The callback function provides the {@link AVMetadata} parameter.
1004     * It only contains the properties set in the filter.
1005     * @throws {BusinessError} 401 - parameter check failed
1006     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
1007     * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist
1008     * @systemapi
1009     * @since 9
1010     */
1011    off(type: 'metadataChange', callback?: (data: AVMetadata) => void);
1012
1013    /**
1014     * Register playback state changed callback
1015     * @param type 'playbackStateChange'
1016     * @param filter The properties of {@link AVPlaybackState} that you cared about
1017     * @param callback The callback used to handle playback state changed event.
1018     * The callback function provides the {@link AVPlaybackState} parameter.
1019     * @throws {BusinessError} 401 - parameter check failed
1020     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
1021     * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist
1022     * @systemapi
1023     * @since 9
1024     */
1025    on(type: 'playbackStateChange', filter: Array<keyof AVPlaybackState> | 'all', callback: (state: AVPlaybackState) => void);
1026
1027    /**
1028     * Unregister playback state changed callback
1029     * @param type 'playbackStateChange'
1030     * @param filter The properties of {@link AVPlaybackState} that you cared about
1031     * @param callback The callback used to handle playback state changed event.
1032     * The callback function provides the {@link AVPlaybackState} parameter.
1033     * @throws {BusinessError} 401 - parameter check failed
1034     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
1035     * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist
1036     * @systemapi
1037     * @since 9
1038     */
1039    off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void);
1040
1041    /**
1042     * Register current session destroyed callback
1043     * @param type 'sessionDestroy'
1044     * @param callback The callback used to handle current session destroyed event.
1045     * @throws {BusinessError} 401 - parameter check failed
1046     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
1047     * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist
1048     * @systemapi
1049     * @since 9
1050     */
1051    on(type: 'sessionDestroy', callback: () => void);
1052
1053    /**
1054     * Unregister current session destroyed callback
1055     * @param type 'sessionDestroy'
1056     * @param callback The callback used to handle current session destroyed event.
1057     * @throws {BusinessError} 401 - parameter check failed
1058     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
1059     * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist
1060     * @systemapi
1061     * @since 9
1062     */
1063    off(type: 'sessionDestroy', callback?: () => void);
1064
1065    /**
1066     * Register the active state of this session changed callback
1067     * @param type 'activeStateChange'
1068     * @param callback The callback used to handle the active state of this session changed event.
1069     * The callback function provides the changed session state.
1070     * @throws {BusinessError} 401 - parameter check failed
1071     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
1072     * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist
1073     * @systemapi
1074     * @since 9
1075     */
1076    on(type: 'activeStateChange', callback: (isActive: boolean) => void);
1077
1078    /**
1079     * Unregister the active state of this session changed callback
1080     * @param type 'activeStateChange'
1081     * @param callback The callback used to handle the active state of this session changed event.
1082     * The callback function provides the changed session state.
1083     * @throws {BusinessError} 401 - parameter check failed
1084     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
1085     * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist
1086     * @systemapi
1087     * @since 9
1088     */
1089    off(type: 'activeStateChange', callback?: (isActive: boolean) => void);
1090
1091    /**
1092     * Register the valid commands of the session changed callback
1093     * @param type 'validCommandChange'
1094     * @param callback The callback used to handle the changes.
1095     * The callback function provides an array of AVControlCommandType.
1096     * @throws {BusinessError} 401 - parameter check failed
1097     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
1098     * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist
1099     * @systemapi
1100     * @since 9
1101     */
1102    on(type: 'validCommandChange', callback: (commands: Array<AVControlCommandType>) => void);
1103
1104    /**
1105     * Unregister the valid commands of the session changed callback
1106     * @param type 'validCommandChange'
1107     * @param callback The callback used to handle the changes.
1108     * The callback function provides an array of AVControlCommandType.
1109     * @throws {BusinessError} 401 - parameter check failed
1110     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
1111     * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist
1112     * @systemapi
1113     * @since 9
1114     */
1115    off(type: 'validCommandChange', callback?: (commands: Array<AVControlCommandType>) => void);
1116
1117    /**
1118     * Register session output device change callback
1119     * @param type Registration Type
1120     * @param callback Used to handle output device changed.
1121     * The callback provide the new device info {@link OutputDeviceInfo}
1122     * @throws {BusinessError} 401 - parameter check failed
1123     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
1124     * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist
1125     * @syscap SystemCapability.Multimedia.AVSession.Core
1126     * @systemapi
1127     * @since 9
1128     */
1129    on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): void;
1130
1131    /**
1132     * Unregister session output device change callback
1133     * @param type Registration Type
1134     * @param callback Used to handle output device changed.
1135     * The callback provide the new device info {@link OutputDeviceInfo}
1136     * @throws {BusinessError} 401 - parameter check failed
1137     * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception
1138     * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist
1139     * @syscap SystemCapability.Multimedia.AVSession.Core
1140     * @systemapi
1141     * @since 9
1142     */
1143    off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): void;
1144  }
1145
1146  /**
1147   * The type of control command
1148   * @syscap SystemCapability.Multimedia.AVSession.Core
1149   * @systemapi
1150   * @since 9
1151   */
1152  type AVControlCommandType = 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' |
1153                              'seek' | 'setSpeed' | 'setLoopMode' | 'toggleFavorite';
1154
1155  /**
1156   * The definition of command to be sent to the session
1157   * @interface AVControlCommand
1158   * @syscap SystemCapability.Multimedia.AVSession.Core
1159   * @systemapi
1160   * @since 9
1161   */
1162  interface AVControlCommand {
1163    /**
1164     * The command value {@link AVControlCommandType}
1165     * @since 9
1166     */
1167    command: AVControlCommandType;
1168    /**
1169     * parameter of the command. Whether this command requires parameters, see {@link AVSessionCommand}
1170     * seek command requires a number parameter
1171     * setSpeed command requires a number parameter
1172     * setLoopMode command requires a {@link LoopMode} parameter.
1173     * toggleFavorite command requires assetId {@link AVMetadata.assetId} parameter
1174     * other commands need no parameter
1175     * @since 9
1176     */
1177    parameter?: LoopMode | string | number;
1178  }
1179
1180  /**
1181   * Enumerates ErrorCode types, returns in BusinessError.code.
1182   * @enum {number}
1183   * @syscap SystemCapability.Multimedia.AVSession.Core
1184   * @systemapi
1185   * @since 9
1186   */
1187  enum AVSessionErrorCode {
1188    /**
1189     * Server exception
1190     * @since 9
1191     */
1192    ERR_CODE_SERVICE_EXCEPTION = 6600101,
1193
1194    /**
1195     * The session does not exist
1196     * @since 9
1197     */
1198    ERR_CODE_SESSION_NOT_EXIST = 6600102,
1199
1200    /**
1201     * The controller does not exist
1202     * @since 9
1203     */
1204    ERR_CODE_CONTROLLER_NOT_EXIST = 6600103,
1205
1206    /**
1207     * Remote connection error
1208     * @since 9
1209     */
1210    ERR_CODE_REMOTE_CONNECTION_ERR = 6600104,
1211
1212    /**
1213     * Command not supported
1214     * @since 9
1215     */
1216    ERR_CODE_COMMAND_INVALID = 6600105,
1217
1218    /**
1219     * Session inactive
1220     * @since 9
1221     */
1222    ERR_CODE_SESSION_INACTIVE = 6600106,
1223
1224    /**
1225     * Command or event overload
1226     * @since 9
1227     */
1228    ERR_CODE_MESSAGE_OVERLOAD = 6600107,
1229  }
1230}
1231
1232export default avSession;
1233