1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 /** 17 * @addtogroup OHAVSession 18 * @{ 19 * 20 * @brief Provide the definition of the C interface for the avsession module. 21 * 22 * @syscap SystemCapability.Multimedia.AVSession.Core 23 * 24 * @since 13 25 * @version 1.0 26 */ 27 28 /** 29 * @file native_avsession.h 30 * 31 * @brief Declare avsession interface. 32 * 33 * @library libohavsession.so 34 * @syscap SystemCapability.Multimedia.AVSession.Core 35 * @kit AVSessionKit 36 * @since 13 37 * @version 1.0 38 */ 39 40 #ifndef NATIVE_AVSESSION_H 41 #define NATIVE_AVSESSION_H 42 43 #include <stdint.h> 44 #include "native_avsession_errors.h" 45 #include "native_avmetadata.h" 46 47 #ifdef __cplusplus 48 extern "C" { 49 #endif 50 51 /** 52 * @brief Enum for avsession type. 53 * 54 * @since 13 55 * @version 1.0 56 */ 57 typedef enum { 58 /** 59 * @brief audio session type. 60 */ 61 SESSION_TYPE_AUDIO = 0, 62 63 /** 64 * @brief video session type. 65 */ 66 SESSION_TYPE_VIDEO = 1, 67 68 /** 69 * @brief voice call session type. 70 */ 71 SESSION_TYPE_VOICE_CALL = 2, 72 73 /** 74 * @brief video call session type. 75 */ 76 SESSION_TYPE_VIDEO_CALL = 3 77 } AVSession_Type; 78 79 /** 80 * @brief Enum for playback state. 81 * 82 * @since 13 83 * @version 1.0 84 */ 85 typedef enum { 86 /** 87 * @brief Initial state. 88 */ 89 PLAYBACK_STATE_INITIAL = 0, 90 91 /** 92 * @brief Preparing state. Indicates that the media file is not ready to play. 93 */ 94 PLAYBACK_STATE_PREPARING = 1, 95 96 /** 97 * @brief Playing state. 98 */ 99 PLAYBACK_STATE_PLAYING = 2, 100 101 /** 102 * @brief Pause state. 103 */ 104 PLAYBACK_STATE_PAUSED = 3, 105 106 /** 107 * @brief Fast forward state. 108 */ 109 PLAYBACK_STATE_FAST_FORWARDING = 4, 110 111 /** 112 * @brief Rewind state. 113 */ 114 PLAYBACK_STATE_REWINDED = 5, 115 116 /** 117 * @brief Stopped state. 118 */ 119 PLAYBACK_STATE_STOPPED = 6, 120 121 /** 122 * @brief Complete state. 123 */ 124 PLAYBACK_STATE_COMPLETED = 7, 125 126 /** 127 * @brief Release state. 128 */ 129 PLAYBACK_STATE_RELEASED = 8, 130 131 /** 132 * @brief Error state. 133 */ 134 PLAYBACK_STATE_ERROR = 9, 135 136 /** 137 * @brief Idle state. 138 */ 139 PLAYBACK_STATE_IDLE = 10, 140 141 /** 142 * @brief Buffering state. 143 */ 144 PLAYBACK_STATE_BUFFERING = 11, 145 146 /** 147 * @brief Max state. 148 */ 149 PLAYBACK_STATE_MAX = 12, 150 } AVSession_PlaybackState; 151 152 /** 153 * @brief Defines the playback position. 154 * 155 * @since 13 156 */ 157 typedef struct AVSession_PlaybackPosition { 158 /** 159 * @brief Elapsed time(position) of this media set by the app. 160 */ 161 int64_t elapsedTime; 162 163 /** 164 * @brief Record the system time when elapsedTime is set. 165 */ 166 int64_t updateTime; 167 } AVSession_PlaybackPosition; 168 169 /** 170 * @brief Defines the playback mode. 171 * 172 * @since 13 173 */ 174 typedef enum { 175 /** 176 * @brief sequential playback mode 177 */ 178 LOOP_MODE_SEQUENCE = 0, 179 180 /** 181 * @brief single playback mode 182 */ 183 LOOP_MODE_SINGLE = 1, 184 185 /** 186 * @brief list playback mode 187 */ 188 LOOP_MODE_LIST = 2, 189 190 /** 191 * @brief shuffle playback mode 192 */ 193 LOOP_MODE_SHUFFLE = 3, 194 195 /** 196 * @brief custom playback mode 197 */ 198 LOOP_MODE_CUSTOM = 4, 199 } AVSession_LoopMode; 200 201 /** 202 * @brief Enum for different control command. 203 * 204 * @since 13 205 * @version 1.0 206 */ 207 typedef enum AVSession_ControlCommand { 208 /** 209 * @brief invalid control command 210 */ 211 CONTROL_CMD_INVALID = -1, 212 213 /** 214 * @brief play command 215 */ 216 CONTROL_CMD_PLAY = 0, 217 218 /** 219 * @brief pause command 220 */ 221 CONTROL_CMD_PAUSE = 1, 222 223 /** 224 * @brief stop command 225 */ 226 CONTROL_CMD_STOP = 2, 227 228 /** 229 * @brief playnext command 230 */ 231 CONTROL_CMD_PLAY_NEXT = 3, 232 233 /** 234 * @brief playprevious command 235 */ 236 CONTROL_CMD_PLAY_PREVIOUS = 4, 237 } AVSession_ControlCommand; 238 239 /** 240 * @brief Defines enumeration of avsession callback result. 241 * 242 * @since 13 243 */ 244 typedef enum { 245 /** 246 * @brief Result of avsession callabck is success. 247 */ 248 AVSESSION_CALLBACK_RESULT_SUCCESS = 0, 249 250 /** 251 * @brief Result of avsession callabck failed. 252 */ 253 AVSESSION_CALLBACK_RESULT_FAILURE = -1, 254 } AVSessionCallback_Result; 255 256 /** 257 * @brief AVSession object 258 * 259 * A pointer can be created using {@link OH_AVSession_Create} method. 260 * 261 * @since 13 262 * @version 1.0 263 */ 264 typedef struct OH_AVSession OH_AVSession; 265 266 /** 267 * @brief Declaring the callback struct for playback command 268 * 269 * @since 13 270 * @version 1.0 271 */ 272 typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnCommand)(OH_AVSession* session, 273 AVSession_ControlCommand command, void* userData); 274 275 /** 276 * @brief Declaring the callback struct for forward command 277 * 278 * @since 13 279 * @version 1.0 280 */ 281 typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnFastForward)(OH_AVSession* session, 282 uint32_t seekTime, void* userData); 283 284 /** 285 * @brief Declaring the callback struct for rewind command 286 * 287 * @since 13 288 * @version 1.0 289 */ 290 typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnRewind)(OH_AVSession* session, 291 uint32_t seekTime, void* userData); 292 293 /** 294 * @brief Declaring the callback struct for seek command 295 * 296 * @since 13 297 * @version 1.0 298 */ 299 typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnSeek)(OH_AVSession* session, 300 uint64_t seekTime, void* userData); 301 302 /** 303 * @brief Declaring the callback struct for set loop mode command 304 * 305 * @since 13 306 * @version 1.0 307 */ 308 typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnSetLoopMode)(OH_AVSession* session, 309 AVSession_LoopMode curLoopMode, void* userData); 310 311 /** 312 * @brief Declaring the callback struct for toggle favorite command 313 * 314 * @since 13 315 * @version 1.0 316 */ 317 typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnToggleFavorite)(OH_AVSession* session, 318 const char* assetId, void* userData); 319 320 /** 321 * @brief Request to create the avsession. 322 * 323 * @param sessionType The session type to set 324 * @param sessionTag The session tag set by the application 325 * @param bundleName The bundle name to set 326 * @param abilityName The abilityName name to set 327 * @param avsession Pointer to a viriable to receive the OH_AVSession 328 * @return Function result code: 329 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 330 * {@link AV_SESSION_ERR_INVALID_PARAMETER}: 331 * 1. The param of sessionType is invalid. 332 * 2. The param of sessionTag is nullptr. 333 * 3. The param of bundleName is nullptr. 334 * 4. The param of abilityName is nullptr. 335 * 5. The param of avsession is nullptr. 336 * @since 13 337 */ 338 AVSession_ErrCode OH_AVSession_Create(AVSession_Type sessionType, const char* sessionTag, 339 const char* bundleName, const char* abilityName, OH_AVSession** avsession); 340 341 /** 342 * @brief Request to destory the avsession. 343 * 344 * @param avsession The avsession instance pointer 345 * @return Function result code: 346 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 347 * {@link AV_SESSION_ERR_INVALID_PARAMETER} The param of avsession is nullptr. 348 * @since 13 349 */ 350 AVSession_ErrCode OH_AVSession_Destroy(OH_AVSession* avsession); 351 352 /** 353 * @brief Activate the avsession. 354 * 355 * @param avsession The avsession instance pointer 356 * @return Function result code: 357 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 358 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 359 * {@link AV_SESSION_ERR_INVALID_PARAMETER} The param of avsession is nullptr. 360 * @since 13 361 */ 362 AVSession_ErrCode OH_AVSession_Activate(OH_AVSession* avsession); 363 364 /** 365 * @brief Deactivate the avsession. 366 * 367 * @param avsession The avsession instance pointer 368 * @return Function result code: 369 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 370 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 371 * {@link AV_SESSION_ERR_INVALID_PARAMETER} The param of avsession is nullptr. 372 * @since 13 373 */ 374 AVSession_ErrCode OH_AVSession_Deactivate(OH_AVSession* avsession); 375 376 /** 377 * @brief Get session type. 378 * 379 * @param avsession The avsession instance pointer 380 * @param sessionType The returned session type 381 * @return Function result code: 382 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 383 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 384 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 385 * 1. The param of avsession is invalid. 386 * 2. The param of sessionType is nullptr. 387 * @since 13 388 */ 389 AVSession_ErrCode OH_AVSession_GetSessionType(OH_AVSession* avsession, AVSession_Type* sessionType); 390 391 /** 392 * @brief Get session id. 393 * 394 * @param avsession The avsession instance pointer 395 * @param sessionId The returned session id 396 * @return Function result code: 397 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 398 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 399 * 1. The param of avsession is nullptr. 400 * 2. The param of sessionId is nullptr. 401 * @since 13 402 */ 403 AVSession_ErrCode OH_AVSession_GetSessionId(OH_AVSession* avsession, const char** sessionId); 404 405 /** 406 * @brief Request to set av metadata. 407 * 408 * @param avsession The avsession instance pointer 409 * @param avmetadata The metadata to set 410 * @return Function result code: 411 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 412 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 413 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 414 * 1. The param of avsession is nullptr. 415 * 2. The param of avmetadata is nullptr. 416 * @since 13 417 */ 418 AVSession_ErrCode OH_AVSession_SetAVMetadata(OH_AVSession* avsession, OH_AVMetadata* avmetadata); 419 420 /** 421 * @brief Request to set av playbackstate. 422 * 423 * @param avsession The avsession instance pointer 424 * @param playbackState The playbackState to set 425 * @return Function result code: 426 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 427 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 428 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 429 * 1. The param of avsession is nullptr. 430 * 2. The param of playbackState is invalid. 431 * @since 13 432 */ 433 AVSession_ErrCode OH_AVSession_SetPlaybackState(OH_AVSession* avsession, 434 AVSession_PlaybackState playbackState); 435 436 /** 437 * @brief Request to set playback position. 438 * 439 * @param avsession The avsession instance pointer 440 * @param playbackPosition The playbackPosition to set 441 * @return Function result code: 442 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 443 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 444 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 445 * 1. The param of avsession is nullptr. 446 * 2. The param of playbackPosition is nullptr. 447 * @since 13 448 */ 449 AVSession_ErrCode OH_AVSession_SetPlaybackPosition(OH_AVSession* avsession, 450 AVSession_PlaybackPosition* playbackPosition); 451 452 /** 453 * @brief Request to set favorite state. 454 * 455 * @param avsession The avsession instance pointer 456 * @param favorite true means making the resource to be liked, false means dislike. 457 * @return Function result code: 458 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 459 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 460 * {@link AV_SESSION_ERR_INVALID_PARAMETER} The param of avsession is nullptr. 461 * @since 13 462 */ 463 AVSession_ErrCode OH_AVSession_SetFavorite(OH_AVSession* avsession, bool favorite); 464 465 /** 466 * @brief Request to set loop mode. 467 * 468 * @param avsession The avsession instance pointer 469 * @param loopMode The loopmode to be set for playback. 470 * @return Function result code: 471 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 472 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 473 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 474 * 1. The param of avsession is nullptr. 475 * 2. The param of loopMode is invalid. 476 * @since 13 477 */ 478 AVSession_ErrCode OH_AVSession_SetLoopMode(OH_AVSession* avsession, AVSession_LoopMode loopMode); 479 480 /** 481 * @brief Request to register command callback. 482 * 483 * @param avsession The avsession instance pointer 484 * @param command The control command type to be registered. 485 * @param callback the {@link OH_AVSessionCallback_OnCommand} to be registered. 486 * @param userData User data which is passed by user. 487 * @return Function result code: 488 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 489 * {@link AV_SESSION_ERR_CODE_COMMAND_INVALID} The command is invalid. 490 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 491 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 492 * 1. The param of avsession is nullptr. 493 * 2. The param of callback is nullptr. 494 * @since 13 495 */ 496 AVSession_ErrCode OH_AVSession_RegisterCommandCallback(OH_AVSession* avsession, 497 AVSession_ControlCommand command, OH_AVSessionCallback_OnCommand callback, void* userData); 498 499 /** 500 * @brief Request to unregister command callback. 501 * 502 * @param avsession The avsession instance pointer 503 * @param command The control command type to be unregistered. 504 * @param callback the {@link OH_AVSessionCallback_OnCommand} to be unregistered. 505 * @return Function result code: 506 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 507 * {@link AV_SESSION_ERR_CODE_COMMAND_INVALID} The command is invalid. 508 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 509 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 510 * 1. The param of avsession is nullptr. 511 * 2. The param of callback is nullptr. 512 * @since 13 513 */ 514 AVSession_ErrCode OH_AVSession_UnregisterCommandCallback(OH_AVSession* avsession, 515 AVSession_ControlCommand command, OH_AVSessionCallback_OnCommand callback); 516 517 /** 518 * @brief Request to register fastforward callback. 519 * 520 * @param avsession The avsession instance pointer 521 * @param callback the {@link OH_AVSessionCallback_OnFastForward} to be registered. 522 * @param userData User data which is passed by user. 523 * @return Function result code: 524 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 525 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 526 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 527 * 1. The param of avsession is nullptr. 528 * 2. The param of callback is nullptr. 529 * @since 13 530 */ 531 AVSession_ErrCode OH_AVSession_RegisterForwardCallback(OH_AVSession* avsession, 532 OH_AVSessionCallback_OnFastForward callback, void* userData); 533 534 /** 535 * @brief Request to unregister fastforward callback. 536 * 537 * @param avsession The avsession instance pointer 538 * @param callback the {@link OH_AVSessionCallback_OnFastForward} to be unregistered. 539 * @return Function result code: 540 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 541 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 542 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 543 * 1. The param of avsession is nullptr. 544 * 2. The param of callback is nullptr. 545 * @since 13 546 */ 547 AVSession_ErrCode OH_AVSession_UnregisterForwardCallback(OH_AVSession* avsession, 548 OH_AVSessionCallback_OnFastForward callback); 549 550 /** 551 * @brief Request to register rewind callback. 552 * 553 * @param avsession The avsession instance pointer 554 * @param callback the {@link OH_AVSessionCallback_OnRewind} to be registered. 555 * @param userData User data which is passed by user. 556 * @return Function result code: 557 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 558 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 559 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 560 * 1. The param of avsession is nullptr. 561 * 2. The param of callback is nullptr. 562 * @since 13 563 */ 564 AVSession_ErrCode OH_AVSession_RegisterRewindCallback(OH_AVSession* avsession, 565 OH_AVSessionCallback_OnRewind callback, void* userData); 566 567 /** 568 * @brief Request to unregister rewind callback. 569 * 570 * @param avsession The avsession instance pointer 571 * @param callback the {@link OH_AVSessionCallback_OnRewind} to be unregistered. 572 * @return Function result code: 573 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 574 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 575 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 576 * 1. The param of avsession is nullptr. 577 * 2. The param of callback is nullptr. 578 * @since 13 579 */ 580 AVSession_ErrCode OH_AVSession_UnregisterRewindCallback(OH_AVSession* avsession, 581 OH_AVSessionCallback_OnRewind callback); 582 583 /** 584 * @brief Request to register seek callback. 585 * 586 * @param avsession The avsession instance pointer 587 * @param callback the {@link OH_AVSessionCallback_OnSeek} to be registered. 588 * @param userData User data which is passed by user. 589 * @return Function result code: 590 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 591 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 592 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 593 * 1. The param of avsession is nullptr. 594 * 2. The param of callback is nullptr. 595 * @since 13 596 */ 597 AVSession_ErrCode OH_AVSession_RegisterSeekCallback(OH_AVSession* avsession, 598 OH_AVSessionCallback_OnSeek callback, void* userData); 599 600 /** 601 * @brief Request to unregister seek callback. 602 * 603 * @param avsession The avsession instance pointer 604 * @param callback the {@link OH_AVSessionCallback_OnSeek} to be unregistered. 605 * @return Function result code: 606 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 607 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 608 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 609 * 1. The param of avsession is nullptr. 610 * 2. The param of callback is nullptr. 611 * @since 13 612 */ 613 AVSession_ErrCode OH_AVSession_UnregisterSeekCallback(OH_AVSession* avsession, 614 OH_AVSessionCallback_OnSeek callback); 615 616 /** 617 * @brief Request to register set loopmode callback. 618 * 619 * @param avsession The avsession instance pointer 620 * @param callback the {@link OH_AVSessionCallback_OnSetLoopMode} to be registered. 621 * @param userData User data which is passed by user. 622 * @return Function result code: 623 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 624 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 625 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 626 * 1. The param of avsession is nullptr. 627 * 2. The param of callback is nullptr. 628 * @since 13 629 */ 630 AVSession_ErrCode OH_AVSession_RegisterSetLoopModeCallback(OH_AVSession* avsession, 631 OH_AVSessionCallback_OnSetLoopMode callback, void* userData); 632 633 /** 634 * @brief Request to unregister set loopmode callback. 635 * 636 * @param avsession The avsession instance pointer 637 * @param callback the {@link OH_AVSessionCallback_OnSetLoopMode} to be unregistered. 638 * @return Function result code: 639 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 640 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 641 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 642 * 1. The param of avsession is nullptr. 643 * 2. The param of callback is nullptr. 644 * @since 13 645 */ 646 AVSession_ErrCode OH_AVSession_UnregisterSetLoopModeCallback(OH_AVSession* avsession, 647 OH_AVSessionCallback_OnSetLoopMode callback); 648 649 /** 650 * @brief Request to register toggle favorite callback. 651 * 652 * @param avsession The avsession instance pointer 653 * @param callback the {@link OH_AVSessionCallback_OnToggleFavorite} to be registered. 654 * @param userData User data which is passed by user. 655 * @return Function result code: 656 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 657 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 658 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 659 * 1. The param of avsession is nullptr. 660 * 2. The param of callback is nullptr. 661 * @since 13 662 */ 663 AVSession_ErrCode OH_AVSession_RegisterToggleFavoriteCallback(OH_AVSession* avsession, 664 OH_AVSessionCallback_OnToggleFavorite callback, void* userData); 665 666 /** 667 * @brief Request to unregister toggle favorite callback. 668 * 669 * @param avsession The avsession instance pointer 670 * @param callback the {@link OH_AVSessionCallback_OnToggleFavorite} to be unregistered. 671 * @return Function result code: 672 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 673 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 674 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 675 * 1. The param of avsession is nullptr. 676 * 2. The param of callback is nullptr. 677 * @since 13 678 */ 679 AVSession_ErrCode OH_AVSession_UnregisterToggleFavoriteCallback(OH_AVSession* avsession, 680 OH_AVSessionCallback_OnToggleFavorite callback); 681 682 #ifdef __cplusplus 683 } 684 #endif 685 686 #endif // NATIVE_AVSESSION_H 687 /** @} */