• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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  * @addtogroup AVPlayer
18  * @{
19  *
20  * @brief Provides APIs of Playback capability for Media Source.
21  *
22  * @Syscap SystemCapability.Multimedia.Media.AVPlayer
23  * @since 11
24  * @version 1.0
25  */
26 
27 /**
28  * @file avplayer.h
29  *
30  * @brief Defines the avplayer APIs. Uses the Native APIs provided by Media AVPlayer
31  *        to play the media source.
32  *
33  * @kit MediaKit
34  * @library libavplayer.so
35  * @since 11
36  * @version 1.0
37  */
38 
39 #ifndef MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVPLAYER_H
40 #define MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVPLAYER_H
41 
42 #include <stdint.h>
43 #include <stdio.h>
44 #include "native_averrors.h"
45 #include "avplayer_base.h"
46 #include "native_audiostream_base.h"
47 
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
53 typedef struct MediaKeySession MediaKeySession;
54 typedef struct DRM_MediaKeySystemInfo DRM_MediaKeySystemInfo;
55 typedef void (*Player_MediaKeySystemInfoCallback)(OH_AVPlayer *play, DRM_MediaKeySystemInfo* mediaKeySystemInfo);
56 
57 /**
58  * @brief Create a player
59  * @syscap SystemCapability.Multimedia.Media.AVPlayer
60  * @return Returns a pointer to an OH_AVPlayer instance
61  * @since 11
62  * @version 1.0
63 */
64 OH_AVPlayer *OH_AVPlayer_Create(void);
65 
66 /**
67  * @brief Sets the playback source for the player. The corresponding source can be http url
68  * @syscap SystemCapability.Multimedia.Media.AVPlayer
69  * @param player Pointer to an OH_AVPlayer instance
70  * @param url Indicates the playback source.
71  * @return Returns {@link AV_ERR_OK} if the url is set successfully; returns an error code defined
72  * in {@link native_averrors.h} otherwise.
73  * @since 11
74  * @version 1.0
75  */
76 OH_AVErrCode OH_AVPlayer_SetURLSource(OH_AVPlayer *player, const char *url);
77 
78 /**
79  * @brief Sets the playback media file descriptor source for the player.
80  * @syscap SystemCapability.Multimedia.Media.AVPlayer
81  * @param player Pointer to an OH_AVPlayer instance
82  * @param fd Indicates the file descriptor of media source.
83  * @param offset Indicates the offset of media source in file descriptor.
84  * @param size Indicates the size of media source.
85  * @return Returns {@link AV_ERR_OK} if the fd source is set successfully; returns an error code defined
86  * in {@link native_averrors.h} otherwise.
87  * @since 11
88  * @version 1.0
89  */
90 OH_AVErrCode OH_AVPlayer_SetFDSource(OH_AVPlayer *player, int32_t fd, int64_t offset, int64_t size);
91 
92 /**
93  * @brief Prepares the playback environment and buffers media data asynchronous.
94  *
95  * This function must be called after {@link SetSource}.
96  *
97  * @syscap SystemCapability.Multimedia.Media.AVPlayer
98  * @param player Pointer to an OH_AVPlayer instance
99  * @return Returns {@link AV_ERR_OK} if {@link Prepare} is successfully added to the task queue;
100  * returns an error code defined in {@link native_averrors.h} otherwise.
101  * @since 11
102  * @version 1.0
103  */
104 OH_AVErrCode OH_AVPlayer_Prepare(OH_AVPlayer *player);
105 
106 /**
107  * @brief Start playback.
108  *
109  * This function must be called after {@link Prepare}. If the player state is <b>Prepared</b>,
110  * this function is called to start playback.
111  *
112  * @syscap SystemCapability.Multimedia.Media.AVPlayer
113  * @param player Pointer to an OH_AVPlayer instance
114  * @return Returns {@link AV_ERR_OK} if the playback is started; otherwise returns an error code defined
115  * in {@link native_averrors.h} otherwise.
116  * @since 11
117  * @version 1.0
118  */
119 OH_AVErrCode OH_AVPlayer_Play(OH_AVPlayer *player);
120 
121 /**
122  * @brief Pauses playback.
123  * @syscap SystemCapability.Multimedia.Media.AVPlayer
124  * @param player Pointer to an OH_AVPlayer instance
125  * @return Returns {@link AV_ERR_OK} if {@link Pause} is successfully added to the task queue;
126  * returns an error code defined in {@link native_averrors.h} otherwise.
127  * @since 11
128  * @version 1.0
129  */
130 OH_AVErrCode OH_AVPlayer_Pause(OH_AVPlayer *player);
131 
132 /**
133  * @brief Stop playback.
134  * @syscap SystemCapability.Multimedia.Media.AVPlayer
135  * @param player Pointer to an OH_AVPlayer instance
136  * @return Returns {@link AV_ERR_OK} if {@link Stop} is successfully added to the task queue;
137  * returns an error code defined in {@link native_averrors.h} otherwise.
138  * @since 11
139  * @version 1.0
140  */
141 OH_AVErrCode OH_AVPlayer_Stop(OH_AVPlayer *player);
142 
143 /**
144  * @brief Restores the player to the initial state.
145  *
146  * After the function is called, add a playback source by calling {@link SetSource},
147  * call {@link Play} to start playback again after {@link Prepare} is called.
148  *
149  * @syscap SystemCapability.Multimedia.Media.AVPlayer
150  * @param player Pointer to an OH_AVPlayer instance
151  * @return Returns {@link AV_ERR_OK} if {@link Reset} is successfully added to the task queue;
152  * returns an error code defined in {@link native_averrors.h} otherwise.
153  * @since 11
154  * @version 1.0
155  */
156 OH_AVErrCode OH_AVPlayer_Reset(OH_AVPlayer *player);
157 
158 /**
159  * @brief Releases player resources async
160  *
161  *  Asynchronous release guarantees the performance
162  *  but cannot ensure whether the surfacebuffer is released.
163  *  The caller needs to ensure the life cycle security of the surface
164  *
165  * @syscap SystemCapability.Multimedia.Media.AVPlayer
166  * @param player Pointer to an OH_AVPlayer instance
167  * @return Returns {@link AV_ERR_OK} if {@link Release} is successfully added to the task queue;
168  * returns an error code defined in {@link native_averrors.h} otherwise.
169  * @since 11
170  * @version 1.0
171  */
172 OH_AVErrCode OH_AVPlayer_Release(OH_AVPlayer *player);
173 
174 /**
175  * @brief Releases player resources sync
176  *
177  * Synchronous release ensures effective release of surfacebuffer
178  * but this interface will take a long time (when the engine is not idle state)
179  * requiring the caller to design an asynchronous mechanism by itself
180  *
181  * @syscap SystemCapability.Multimedia.Media.AVPlayer
182  * @param player Pointer to an OH_AVPlayer instance
183  * @return Returns {@link AV_ERR_OK} if the playback is released; returns an error code defined
184  * in {@link native_averrors.h} otherwise.
185  * @since 11
186  * @version 1.0
187  */
188 OH_AVErrCode OH_AVPlayer_ReleaseSync(OH_AVPlayer *player);
189 
190 /**
191  * @brief Sets the volume of the player.
192  *
193  * This function can be used during playback or pause. The value <b>0</b> indicates no sound,
194  * and <b>1</b> indicates the original volume. If no audio device is started or no audio
195  * stream exists, the value <b>-1</b> is returned.
196  *
197  * @syscap SystemCapability.Multimedia.Media.AVPlayer
198  * @param player Pointer to an OH_AVPlayer instance
199  * @param leftVolume Indicates the target volume of the left audio channel to set,
200  *        ranging from 0 to 1. each step is 0.01.
201  * @param rightVolume Indicates the target volume of the right audio channel to set,
202  *        ranging from 0 to 1. each step is 0.01.
203  * @return Returns {@link AV_ERR_OK} if the volume is set; returns an error code defined
204  * in {@link native_averrors.h} otherwise.
205  * @since 11
206  * @version 1.0
207  */
208 OH_AVErrCode OH_AVPlayer_SetVolume(OH_AVPlayer *player, float leftVolume, float rightVolume);
209 
210 /**
211  * @brief Changes the playback position.
212  *
213  * This function can be used during play or pause.
214  *
215  * @syscap SystemCapability.Multimedia.Media.AVPlayer
216  * @param player Pointer to an OH_AVPlayer instance
217  * @param mSeconds Indicates the target playback position, accurate to milliseconds.
218  * @param mode Indicates the player seek mode. For details, see {@link AVPlayerSeekMode}.
219  * @return Returns {@link AV_ERR_OK} if the seek is done; returns an error code defined
220  * in {@link native_averrors.h} otherwise.
221  * @since 11
222  * @version 1.0
223 */
224 OH_AVErrCode OH_AVPlayer_Seek(OH_AVPlayer *player, int32_t mSeconds, AVPlayerSeekMode mode);
225 
226 /**
227  * @brief Obtains the playback position, accurate to millisecond.
228  * @syscap SystemCapability.Multimedia.Media.AVPlayer
229  * @param player Pointer to an OH_AVPlayer instance
230  * @param currentTime Indicates the playback position.
231  * @return Returns {@link AV_ERR_OK} if the current position is get; returns an error code defined
232  * in {@link native_averrors.h} otherwise.
233  * @since 11
234  * @version 1.0
235  */
236 OH_AVErrCode OH_AVPlayer_GetCurrentTime(OH_AVPlayer *player, int32_t *currentTime);
237 
238 /**
239  * @brief get the video width.
240  * @syscap SystemCapability.Multimedia.Media.AVPlayer
241  * @param player Pointer to an OH_AVPlayer instance
242  * @param videoWidth The video width
243  * @return Returns {@link AV_ERR_OK} if the current position is get; returns an error code defined
244  * in {@link native_averrors.h} otherwise.
245  * @since 11
246  * @version 1.0
247  */
248 OH_AVErrCode OH_AVPlayer_GetVideoWidth(OH_AVPlayer *player, int32_t *videoWidth);
249 
250 /**
251  * @brief get the video height.
252  * @syscap SystemCapability.Multimedia.Media.AVPlayer
253  * @param player Pointer to an OH_AVPlayer instance
254  * @param videoHeight The video height
255  * @return Returns {@link AV_ERR_OK} if the current position is get; returns an error code defined
256  * in {@link native_averrors.h} otherwise.
257  * @since 11
258  * @version 1.0
259  */
260 OH_AVErrCode OH_AVPlayer_GetVideoHeight(OH_AVPlayer *player, int32_t *videoHeight);
261 
262 /**
263  * @brief set the player playback rate
264  * @syscap SystemCapability.Multimedia.Media.AVPlayer
265  * @param player Pointer to an OH_AVPlayer instance
266  * @param speed the rate mode {@link AVPlaybackSpeed} which can set.
267  * @return Returns {@link AV_ERR_OK} if the playback rate is set successful; returns an error code defined
268  * in {@link native_averrors.h} otherwise.
269  * @since 11
270  * @version 1.0
271  */
272 OH_AVErrCode OH_AVPlayer_SetPlaybackSpeed(OH_AVPlayer *player, AVPlaybackSpeed speed);
273 
274 /**
275  * @brief Sets playback parameters.
276  * Supported states: prepared/playing/paused/completed.
277  * @syscap SystemCapability.Multimedia.Media.AVPlayer
278  * @param player Pointer to OH_AVPlayer instance
279  * @param rate Playback rate
280  * @return OH_AVErrCode Operation result code
281  *         {@link AV_ERR_OK} if the execution is successful.
282  *         {@link AV_ERR_OPERATE_NOT_PERMIT} if called in unsupported state or during live streaming.
283  *         {@link AV_ERR_INVALID_VAL} if input player or params is nullptr, or parameter is out of range.
284  * @since 20
285  */
286 OH_AVErrCode OH_AVPlayer_SetPlaybackRate(OH_AVPlayer *player, float rate);
287 
288 /**
289  * @brief get the current player playback rate
290  * @syscap SystemCapability.Multimedia.Media.AVPlayer
291  * @param player Pointer to an OH_AVPlayer instance
292  * @param speed the rate mode {@link AVPlaybackSpeed} which can get.
293  * @return Returns {@link AV_ERR_OK} if the current player playback rate is get; returns an error code defined
294  * in {@link native_averrors.h} otherwise.
295  * @since 11
296  * @version 1.0
297  */
298 OH_AVErrCode OH_AVPlayer_GetPlaybackSpeed(OH_AVPlayer *player, AVPlaybackSpeed *speed);
299 
300 /**
301  * @brief Set the renderer information of the player's audio renderer
302  * @param player Pointer to an OH_AVPlayer instance
303  * @param streamUsage The value {@link OH_AudioStream_Usage} used for the stream usage of the player audio render.
304  * @return Function result code.
305  *     {@link AV_ERR_OK} if the execution is successful.
306  *     {@link AV_ERR_INVALID_VAL} if input player is nullptr or streamUsage value is invalid.
307  * @since 12
308  * @version 1.0
309  */
310 OH_AVErrCode OH_AVPlayer_SetAudioRendererInfo(OH_AVPlayer *player, OH_AudioStream_Usage streamUsage);
311 
312 /**
313  * @brief Set the volume mode of the player's audio renderer
314  * @param player Pointer to an OH_AVPlayer instance
315  * @param mode The value {@link OH_AudioStream_VolumeMode} used for the volume mode of the player audio render.
316  * @return Function result code.
317  *     {@link AV_ERR_OK} if the execution is successful.
318  *     {@link AV_ERR_INVALID_VAL} if input player is nullptr or streamUsage value is invalid.
319  * @since 16
320  * @version 1.0
321  */
322 OH_AVErrCode OH_AVPlayer_SetVolumeMode(OH_AVPlayer *player, OH_AudioStream_VolumeMode mode);
323 
324 /**
325  * @brief Set the interruption mode of the player's audio stream
326  * @param player Pointer to an OH_AVPlayer instance
327  * @param interruptMode The value {@link OH_AudioInterrupt_Mode} used for the interruption mode of
328  *                      the player audio stream.
329  * @return Function result code.
330  *     {@link AV_ERR_OK} if the execution is successful.
331  *     {@link AV_ERR_INVALID_VAL} if input player is nullptr or interruptMode value is invalid.
332  * @since 12
333  * @version 1.0
334  */
335 OH_AVErrCode OH_AVPlayer_SetAudioInterruptMode(OH_AVPlayer *player, OH_AudioInterrupt_Mode interruptMode);
336 
337 /**
338  * @brief Set the effect mode of the player's audio stream
339  * @param player Pointer to an OH_AVPlayer instance
340  * @param effectMode The value {@link OH_AudioStream_AudioEffectMode} used for the effect mode of
341  *                   the player audio stream.
342  * @return Function result code.
343  *     {@link AV_ERR_OK} if the execution is successful.
344  *     {@link AV_ERR_INVALID_VAL} if input player is nullptr or effectMode value is invalid.
345  * @since 12
346  * @version 1.0
347  */
348 OH_AVErrCode OH_AVPlayer_SetAudioEffectMode(OH_AVPlayer *player, OH_AudioStream_AudioEffectMode effectMode);
349 
350 /**
351  * @brief set the bit rate use for hls player
352  *
353  * the playback bitrate expressed in bits per second, expressed in bits per second,
354  * which is only valid for HLS protocol network flow. By default,
355  * the player will select the appropriate bit rate and speed according to the network connection.
356  * report the effective bit rate linked list by "INFO_TYPE_BITRATE_COLLECT"
357  * set and select the specified bit rate, and select the bit rate that is less than and closest
358  * to the specified bit rate for playback. When ready, read it to query the currently selected bit rate.
359  *
360  * @syscap SystemCapability.Multimedia.Media.AVPlayer
361  * @param player Pointer to an OH_AVPlayer instance
362  * @param bitRate the bit rate, The unit is bps.
363  * @return Returns {@link AV_ERR_OK} if the bit rate is set successfully; returns an error code defined
364  * in {@link native_averrors.h} otherwise.
365  * @since 11
366  * @version 1.0
367  */
368 OH_AVErrCode OH_AVPlayer_SelectBitRate(OH_AVPlayer *player, uint32_t bitRate);
369 
370 /**
371  * @brief Method to set the surface.
372  * @syscap SystemCapability.Multimedia.Media.AVPlayer
373  * @param player Pointer to an OH_AVPlayer instance
374  * @param window A pointer to a OHNativeWindow instance, see {@link OHNativeWindow}
375  * @return Returns {@link AV_ERR_OK} if the surface is set; returns an error code defined
376  * in {@link native_averrors.h} otherwise.
377  * @since 11
378  * @version 1.0
379  */
380 OH_AVErrCode  OH_AVPlayer_SetVideoSurface(OH_AVPlayer *player, OHNativeWindow *window);
381 
382 /**
383  * @brief Obtains the total duration of media files, accurate to milliseconds.
384  * @syscap SystemCapability.Multimedia.Media.AVPlayer
385  * @param player Pointer to an OH_AVPlayer instance
386  * @param duration Indicates the total duration of media files.
387  * @return Returns {@link AV_ERR_OK} if the current duration is get; returns an error code defined
388  * in {@link native_averrors.h} otherwise.
389  * @since 11
390  * @version 1.0
391  */
392 OH_AVErrCode OH_AVPlayer_GetDuration(OH_AVPlayer *player, int32_t *duration);
393 
394 /**
395  * @brief get current playback state.
396  * @syscap SystemCapability.Multimedia.Media.AVPlayer
397  * @param player Pointer to an OH_AVPlayer instance
398  * @param state the current playback state
399  * @return Returns {@link AV_ERR_OK} if the current duration is get; returns an error code defined
400  * in {@link native_averrors.h} otherwise.
401  * @since 11
402  * @version 1.0
403  */
404 OH_AVErrCode OH_AVPlayer_GetState(OH_AVPlayer *player, AVPlayerState *state);
405 
406 /**
407  * @brief Checks whether the player is playing.
408  * @syscap SystemCapability.Multimedia.Media.AVPlayer
409  * @param player Pointer to an OH_AVPlayer instance
410  * @return Returns true if the playback is playing; false otherwise.
411  * @since 11
412  * @version 1.0
413  */
414 bool OH_AVPlayer_IsPlaying(OH_AVPlayer *player);
415 
416 /**
417  * @brief Returns the value whether single looping is enabled or not .
418  * @syscap SystemCapability.Multimedia.Media.AVPlayer
419  * @param player Pointer to an OH_AVPlayer instance
420  * @return Returns true if the playback is single looping; false otherwise.
421  * @since 11
422  * @version 1.0
423  */
424 bool OH_AVPlayer_IsLooping(OH_AVPlayer *player);
425 
426 /**
427  * @brief Enables single looping of the media playback.
428  * @syscap SystemCapability.Multimedia.Media.AVPlayer
429  * @param player Pointer to an OH_AVPlayer instance
430  * @param loop The switch to set loop
431  * @return Returns {@link AV_ERR_OK} if the single looping is set; returns an error code defined
432  * in {@link native_averrors.h} otherwise.
433  * @since 11
434  * @version 1.0
435  */
436 OH_AVErrCode OH_AVPlayer_SetLooping(OH_AVPlayer *player, bool loop);
437 
438 /**
439  * @brief Method to set player callback.
440  * @syscap SystemCapability.Multimedia.Media.AVPlayer
441  * @param player Pointer to an OH_AVPlayer instance
442  * @param callback object pointer.
443  * @return Returns {@link AV_ERR_OK} if the playercallback is set; returns an error code defined
444  * in {@link native_averrors.h} otherwise.
445  * @since 11
446  * @deprecated since 12
447  * @useinstead {@link OH_AVPlayer_SetPlayerOnInfoCallback} {@link OH_AVPlayer_SetPlayerOnErrorCallback}
448  * @version 1.0
449  */
450 OH_AVErrCode OH_AVPlayer_SetPlayerCallback(OH_AVPlayer *player, AVPlayerCallback callback);
451 
452 /**
453  * @brief Select audio or subtitle track.
454  *
455  * By default, the first audio stream with data is played, and the subtitle track is not played.
456  * After the settings take effect, the original track will become invalid. Please set subtitles
457  * in prepared/playing/paused/completed state and set audio tracks in prepared state.
458  *
459  * @syscap SystemCapability.Multimedia.Media.AVPlayer
460  * @param player Pointer to an OH_AVPlayer instance
461  * @param index Track index
462  * @return Returns {@link AV_ERR_OK} if selected successfully; returns an error code defined
463  * in {@link native_averrors.h} otherwise.
464  * @since 11
465  * @version 1.0
466 */
467 OH_AVErrCode OH_AVPlayer_SelectTrack(OH_AVPlayer *player, int32_t index);
468 
469 /**
470  * @brief Deselect the current audio or subtitle track.
471  *
472  * After audio is deselected, the default track will be played, and after subtitles are deselected,
473  * they will not be played. Please set subtitles in prepared/playing/paused/completed state and set
474  * audio tracks in prepared state.
475  *
476  * @syscap SystemCapability.Multimedia.Media.AVPlayer
477  * @param player Pointer to an OH_AVPlayer instance
478  * @param index Track index
479  * @return Returns {@link AV_ERR_OK} if selected successfully; returns an error code defined
480  * in {@link native_averrors.h} otherwise.
481  * @since 11
482  * @version 1.0
483 */
484 OH_AVErrCode OH_AVPlayer_DeselectTrack(OH_AVPlayer *player, int32_t index);
485 
486 /**
487  * @brief Obtain the currently effective track index.
488  *
489  * Please get it in the prepared/playing/paused/completed state.
490  *
491  * @syscap SystemCapability.Multimedia.Media.AVPlayer
492  * @param player Pointer to an OH_AVPlayer instance
493  * @param trackType Media type.
494  * @param index Track index
495  * @return Returns {@link AV_ERR_OK} if the track index is get; returns an error code defined
496  * in {@link native_averrors.h} otherwise.
497  * @since 11
498  * @version 1.0
499  */
500 OH_AVErrCode OH_AVPlayer_GetCurrentTrack(OH_AVPlayer *player, int32_t trackType, int32_t *index);
501 
502 /**
503  * @brief Method to set player media key system info callback.
504  * @syscap SystemCapability.Multimedia.Media.AVPlayer
505  * @param player Pointer to an OH_AVPlayer instance
506  * @param callback object pointer.
507  * @return Returns {@link AV_ERR_OK} if the drm info callback is set; returns an error code defined
508  * in {@link native_averrors.h} otherwise.
509  * @since 12
510  * @version 1.0
511  */
512 OH_AVErrCode OH_AVPlayer_SetMediaKeySystemInfoCallback(OH_AVPlayer *player,
513     Player_MediaKeySystemInfoCallback callback);
514 
515 /**
516  * @brief Obtains media key system info to create media key session.
517  * @syscap SystemCapability.Multimedia.Media.AVPlayer
518  * @param player Pointer to an OH_AVPlayer instance
519  * @param mediaKeySystemInfo Media key system info.
520  * @return Returns {@link AV_ERR_OK} if the current position is get; returns an error code defined
521  * in {@link native_averrors.h} otherwise.
522  * @since 12
523  * @version 1.0
524  */
525 OH_AVErrCode OH_AVPlayer_GetMediaKeySystemInfo(OH_AVPlayer *player, DRM_MediaKeySystemInfo *mediaKeySystemInfo);
526 
527 /**
528  * @brief Set decryption info.
529  *
530  * @syscap SystemCapability.Multimedia.Media.AVPlayer
531  * @param player Pointer to an OH_AVPlayer instance
532  * @param mediaKeySession A media key session instance with decryption function.
533  * @param secureVideoPath Require secure decoder or not.
534  * @return Returns AV_ERR_OK if the execution is successful,
535  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}
536  * @since 12
537  * @version 1.0
538 */
539 OH_AVErrCode OH_AVPlayer_SetDecryptionConfig(OH_AVPlayer *player, MediaKeySession *mediaKeySession,
540     bool secureVideoPath);
541 
542 /**
543  * @brief Method to set player information notify callback.
544  * @syscap SystemCapability.Multimedia.Media.AVPlayer
545  * @param player Pointer to an OH_AVPlayer instance.
546  * @param callback Pointer to callback function, nullptr indicates unregister callback.
547  * @param userData Pointer to user specific data.
548  * @return Function result code.
549  *         {@link AV_ERR_OK} if the execution is successful.
550  *         {@link AV_ERR_INVALID_VAL} if input player is null or player SetOnInfoCallback failed.
551  * @since 12
552  */
553 OH_AVErrCode OH_AVPlayer_SetOnInfoCallback(OH_AVPlayer *player, OH_AVPlayerOnInfoCallback callback, void *userData);
554 
555 /**
556  * @brief Method to set player error callback.
557  * @syscap SystemCapability.Multimedia.Media.AVPlayer
558  * @param player Pointer to an OH_AVPlayer instance.
559  * @param callback Pointer to callback function, nullptr indicates unregister callback.
560  * @param userData Pointer to user specific data.
561  * @return Function result code.
562  *         {@link AV_ERR_OK} if the execution is successful.
563  *         {@link AV_ERR_INVALID_VAL} if input player is null or player SetOnErrorCallback failed.
564  * @since 12
565  */
566 OH_AVErrCode OH_AVPlayer_SetOnErrorCallback(OH_AVPlayer *player, OH_AVPlayerOnErrorCallback callback, void *userData);
567 
568 #ifdef __cplusplus
569 }
570 #endif
571 
572 #endif // MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVPLAYER_H
573