目录

native_avcastcontroller.h

Overview

Declares the definitions of the playback controller.

File to include:: <multimedia/av_session/native_avcastcontroller.h>

Library: libohavsession.so

System capability: SystemCapability.Multimedia.AVSession.Core

Since: 23

Related module: OHAVSession

Summary

[h2]Structs

Name typedef Keyword Description
OH_AVCastController OH_AVCastController Defines the playback controller object. You can use the OH_AVSession_CreateAVCastController method to create a pointer.

[h2]Functions

Name typedef Keyword Description
typedef AVSessionCallback_Result(*OH_AVCastControllerCallback_PlaybackStateChanged)(OH_AVCastController* avcastcontroller, OH_AVSession_AVPlaybackState* playbackState, void* userData) OH_AVCastControllerCallback_PlaybackStateChanged Triggered when the playback state changes.
typedef AVSessionCallback_Result(*OH_AVCastControllerCallback_MediaItemChange)(OH_AVCastController* avcastcontroller, OH_AVSession_AVQueueItem* avQueueItem, void* userData) OH_AVCastControllerCallback_MediaItemChange Triggered when the media item changes.
typedef AVSessionCallback_Result(*OH_AVCastControllerCallback_PlayNext)(OH_AVCastController* avcastcontroller, void* userData) OH_AVCastControllerCallback_PlayNext Triggered when the next track is played.
typedef AVSessionCallback_Result(*OH_AVCastControllerCallback_PlayPrevious)(OH_AVCastController* avcastcontroller, void* userData) OH_AVCastControllerCallback_PlayPrevious Triggered when the previous track is played.
typedef AVSessionCallback_Result(*OH_AVCastControllerCallback_SeekDone)(OH_AVCastController* avcastcontroller, int32_t position, void* userData) OH_AVCastControllerCallback_SeekDone Triggered when the seek is complete.
typedef AVSessionCallback_Result(*OH_AVCastControllerCallback_EndOfStream)(OH_AVCastController* avcastcontroller, void* userData) OH_AVCastControllerCallback_EndOfStream Triggered when the playback stream ends.
typedef AVSessionCallback_Result(*OH_AVCastControllerCallback_Error)(OH_AVCastController* avcastcontroller, void* userData, AVSession_ErrCode error) OH_AVCastControllerCallback_Error Triggered when a playback error occurs.
AVSession_ErrCode OH_AVCastController_Destroy(OH_AVCastController* avcastcontroller) - Requests to destroy the playback controller object.
AVSession_ErrCode OH_AVCastController_GetPlaybackState(OH_AVCastController* avcastcontroller, OH_AVSession_AVPlaybackState** playbackState) -

Obtains the playback state of the current player. Do not release the playbackState pointer separately.

When OH_AVCastController_Destroy is called, this pointer will be destroyed together with the playback controller.

AVSession_ErrCode OH_AVCastController_RegisterPlaybackStateChangedCallback(OH_AVCastController* avcastcontroller, int32_t filter, OH_AVCastControllerCallback_PlaybackStateChanged callback, void* userData) - Requests to register a callback for playback state changes.
AVSession_ErrCode OH_AVCastController_UnregisterPlaybackStateChangedCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_PlaybackStateChanged callback) - Requests to unregister a callback for playback state changes.
AVSession_ErrCode OH_AVCastController_RegisterMediaItemChangedCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_MediaItemChange callback, void* userData) - Requests to register a callback for changes to the media item being played.
AVSession_ErrCode OH_AVCastController_UnregisterMediaItemChangedCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_MediaItemChange callback) - Requests to unregister a callback for changes to the media item being played.
AVSession_ErrCode OH_AVCastController_RegisterPlayNextCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_PlayNext callback, void* userData) - Requests to register a callback for the next track request sent by the remote device or media center.
AVSession_ErrCode OH_AVCastController_UnregisterPlayNextCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_PlayNext callback) - Requests to unregister a callback for the next track request sent by the remote device or media center.
AVSession_ErrCode OH_AVCastController_RegisterPlayPreviousCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_PlayPrevious callback, void* userData) - Requests to register a callback for the previous track request sent by the remote device or media center.
AVSession_ErrCode OH_AVCastController_UnregisterPlayPreviousCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_PlayPrevious callback) - Requests to unregister a callback for the previous track request sent by the remote device or media center.
AVSession_ErrCode OH_AVCastController_RegisterSeekDoneCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_SeekDone callback, void* userData) - Requests to register a callback for the seek completion.
AVSession_ErrCode OH_AVCastController_UnregisterSeekDoneCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_SeekDone callback) - Requests to unregister the callback for the seek completion.
AVSession_ErrCode OH_AVCastController_RegisterEndOfStreamCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_EndOfStream callback, void* userData) - Requests to register a callback for the end of stream.
AVSession_ErrCode OH_AVCastController_UnregisterEndOfStreamCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_EndOfStream callback) - Requests to unregister a callback for the end of stream.
AVSession_ErrCode OH_AVCastController_RegisterErrorCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_Error callback, void* userData) - Requests to register a callback for the playback error event.
AVSession_ErrCode OH_AVCastController_UnregisterErrorCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_Error callback) - Requests to unregister a callback for the playback error event.
AVSession_ErrCode OH_AVCastController_SendCommonCommand(OH_AVCastController* avcastcontroller, AVSession_AVCastControlCommandType* avCastControlcommand) - Requests to send a common command to the remote device. Only commands such as play, pause, stop, next, and previous are supported.
AVSession_ErrCode OH_AVCastController_SendSeekCommand(OH_AVCastController* avcastcontroller, int32_t seekTimeMS) - Requests to send a seek command to the remote device.
AVSession_ErrCode OH_AVCastController_SendFastForwardCommand(OH_AVCastController* avcastcontroller, int32_t forwardTimeS) - Requests to send a fast-forward command to the remote device.
AVSession_ErrCode OH_AVCastController_SendRewindCommand(OH_AVCastController* avcastcontroller, int32_t rewindTimeS) - Requests to send a rewind command to the remote device.
AVSession_ErrCode OH_AVCastController_SendSetSpeedCommand(OH_AVCastController* avcastcontroller, AVSession_PlaybackSpeed speed) - Requests to send a speed setting command to the remote device.
AVSession_ErrCode OH_AVCastController_SendVolumeCommand(OH_AVCastController* avcastcontroller, int32_t volume) - Requests to send a volume control command to the remote device.
AVSession_ErrCode OH_AVCastController_Prepare(OH_AVCastController* avcastcontroller, OH_AVSession_AVQueueItem* avqueueItem) - Requests to prepare the current audio or video playback queue item. This operation is a prerequisite for displaying output media information.
AVSession_ErrCode OH_AVCastController_Start(OH_AVCastController* avcastcontroller, OH_AVSession_AVQueueItem* avqueueItem) - Requests to play the current item. The parameter should contain media resources; otherwise, playback will fail.

Function Description

[h2]OH_AVCastControllerCallback_PlaybackStateChanged()

typedef AVSessionCallback_Result(*OH_AVCastControllerCallback_PlaybackStateChanged)(OH_AVCastController* avcastcontroller, OH_AVSession_AVPlaybackState* playbackState, void* userData)

Description

Triggered when the playback state changes.

Since: 23

[h2]OH_AVCastControllerCallback_MediaItemChange()

typedef AVSessionCallback_Result(*OH_AVCastControllerCallback_MediaItemChange)(OH_AVCastController* avcastcontroller, OH_AVSession_AVQueueItem* avQueueItem, void* userData)

Description

Triggered when the media item changes.

Since: 23

[h2]OH_AVCastControllerCallback_PlayNext()

typedef AVSessionCallback_Result(*OH_AVCastControllerCallback_PlayNext)(OH_AVCastController* avcastcontroller, void* userData)

Description

Triggered when the next track is played.

Since: 23

[h2]OH_AVCastControllerCallback_PlayPrevious()

typedef AVSessionCallback_Result(*OH_AVCastControllerCallback_PlayPrevious)(OH_AVCastController* avcastcontroller, void* userData)

Description

Triggered when the previous track is played.

Since: 23

[h2]OH_AVCastControllerCallback_SeekDone()

typedef AVSessionCallback_Result(*OH_AVCastControllerCallback_SeekDone)(OH_AVCastController* avcastcontroller, int32_t position, void* userData)

Description

Triggered when the seek is complete.

Since: 23

[h2]OH_AVCastControllerCallback_EndOfStream()

typedef AVSessionCallback_Result(*OH_AVCastControllerCallback_EndOfStream)(OH_AVCastController* avcastcontroller, void* userData)

Description

Triggered when the playback stream ends.

Since: 23

[h2]OH_AVCastControllerCallback_Error()

typedef AVSessionCallback_Result(*OH_AVCastControllerCallback_Error)(OH_AVCastController* avcastcontroller, void* userData, AVSession_ErrCode error)

Description

Triggered when a playback error occurs.

Since: 23

[h2]OH_AVCastController_Destroy()

AVSession_ErrCode OH_AVCastController_Destroy(OH_AVCastController* avcastcontroller)

Description

Requests to destroy the playback controller object.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER: The avcastcontroller parameter is nullptr.

[h2]OH_AVCastController_GetPlaybackState()

AVSession_ErrCode OH_AVCastController_GetPlaybackState(OH_AVCastController* avcastcontroller, OH_AVSession_AVPlaybackState** playbackState)

Description

Obtains the playback state of the current player. Do not release the playbackState pointer separately. When OH_AVCastController_Destroy is called, this pointer will be destroyed together with the playback controller.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.
OH_AVSession_AVPlaybackState** playbackState Double pointer to the playback state.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER:

1. The avcastcontroller parameter is nullptr.

2. The playbackState parameter is nullptr.

[h2]OH_AVCastController_RegisterPlaybackStateChangedCallback()

AVSession_ErrCode OH_AVCastController_RegisterPlaybackStateChangedCallback(OH_AVCastController* avcastcontroller, int32_t filter, OH_AVCastControllerCallback_PlaybackStateChanged callback, void* userData)

Description

Requests to register a callback for playback state changes.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.
int32_t filter AVSession_PlaybackFilter used to determine the parameters to be included in the callback.
OH_AVCastControllerCallback_PlaybackStateChanged callback Callback to register.
void* userData Pointer to the user data passed by the user.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER:

1. The avcastcontroller parameter is nullptr.

2. The callback parameter is nullptr.

3. The filter parameter is invalid.

[h2]OH_AVCastController_UnregisterPlaybackStateChangedCallback()

AVSession_ErrCode OH_AVCastController_UnregisterPlaybackStateChangedCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_PlaybackStateChanged callback)

Description

Requests to unregister a callback for playback state changes.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.
OH_AVCastControllerCallback_PlaybackStateChanged callback Callback to unregister.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER:

1. The avcastcontroller parameter is nullptr.

2. The callback parameter is nullptr.

[h2]OH_AVCastController_RegisterMediaItemChangedCallback()

AVSession_ErrCode OH_AVCastController_RegisterMediaItemChangedCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_MediaItemChange callback, void* userData)

Description

Requests to register a callback for changes to the media item being played.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.
OH_AVCastControllerCallback_MediaItemChange callback Callback to register.
void* userData Pointer to the user data passed by the user.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER:

1. The avcastcontroller parameter is nullptr.

2. The callback parameter is nullptr.

[h2]OH_AVCastController_UnregisterMediaItemChangedCallback()

AVSession_ErrCode OH_AVCastController_UnregisterMediaItemChangedCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_MediaItemChange callback)

Description

Requests to unregister a callback for changes to the media item being played.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.
OH_AVCastControllerCallback_MediaItemChange callback Callback to unregister.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER:

1. The avcastcontroller parameter is nullptr.

2. The callback parameter is nullptr.

[h2]OH_AVCastController_RegisterPlayNextCallback()

AVSession_ErrCode OH_AVCastController_RegisterPlayNextCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_PlayNext callback, void* userData)

Description

Requests to register a callback for the next track request sent by the remote device or media center.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.
OH_AVCastControllerCallback_PlayNext callback Callback to register.
void* userData Pointer to the user data passed by the user.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER:

1. The avcastcontroller parameter is nullptr.

2. The callback parameter is nullptr.

[h2]OH_AVCastController_UnregisterPlayNextCallback()

AVSession_ErrCode OH_AVCastController_UnregisterPlayNextCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_PlayNext callback)

Description

Requests to unregister a callback for the next track request sent by the remote device or media center.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.
OH_AVCastControllerCallback_PlayNext callback Callback to unregister.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER:

1. The avcastcontroller parameter is nullptr.

2. The callback parameter is nullptr.

[h2]OH_AVCastController_RegisterPlayPreviousCallback()

AVSession_ErrCode OH_AVCastController_RegisterPlayPreviousCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_PlayPrevious callback, void* userData)

Description

Requests to register a callback for the previous track request sent by the remote device or media center.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.
OH_AVCastControllerCallback_PlayPrevious callback Callback to register.
void* userData Pointer to the user data passed by the user.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER:

1. The avcastcontroller parameter is nullptr.

2. The callback parameter is nullptr.

[h2]OH_AVCastController_UnregisterPlayPreviousCallback()

AVSession_ErrCode OH_AVCastController_UnregisterPlayPreviousCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_PlayPrevious callback)

Description

Requests to unregister a callback for the previous track request sent by the remote device or media center.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.
OH_AVCastControllerCallback_PlayPrevious callback Callback to unregister.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER:

1. The avcastcontroller parameter is nullptr.

2. The callback parameter is nullptr.

[h2]OH_AVCastController_RegisterSeekDoneCallback()

AVSession_ErrCode OH_AVCastController_RegisterSeekDoneCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_SeekDone callback, void* userData)

Description

Requests to register a callback for the seek completion.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.
OH_AVCastControllerCallback_SeekDone callback Callback to register.
void* userData Pointer to the user data passed by the user.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER:

1. The avcastcontroller parameter is nullptr.

2. The callback parameter is nullptr.

[h2]OH_AVCastController_UnregisterSeekDoneCallback()

AVSession_ErrCode OH_AVCastController_UnregisterSeekDoneCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_SeekDone callback)

Description

Requests to unregister the callback for the seek completion.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.
OH_AVCastControllerCallback_SeekDone callback Callback to unregister.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER:

1. The avcastcontroller parameter is nullptr.

2. The callback parameter is nullptr.

[h2]OH_AVCastController_RegisterEndOfStreamCallback()

AVSession_ErrCode OH_AVCastController_RegisterEndOfStreamCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_EndOfStream callback, void* userData)

Description

Requests to register a callback for the end of stream.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.
OH_AVCastControllerCallback_EndOfStream callback Callback to register.
void* userData Pointer to the user data passed by the user.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER:

1. The avcastcontroller parameter is nullptr.

2. The callback parameter is nullptr.

[h2]OH_AVCastController_UnregisterEndOfStreamCallback()

AVSession_ErrCode OH_AVCastController_UnregisterEndOfStreamCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_EndOfStream callback)

Description

Requests to unregister a callback for the end of stream.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.
OH_AVCastControllerCallback_EndOfStream callback Callback to unregister.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER:

1. The avcastcontroller parameter is nullptr.

2. The callback parameter is nullptr.

[h2]OH_AVCastController_RegisterErrorCallback()

AVSession_ErrCode OH_AVCastController_RegisterErrorCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_Error callback, void* userData)

Description

Requests to register a callback for the playback error event.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.
OH_AVCastControllerCallback_Error callback Callback to register.
void* userData Pointer to the user data passed by the user.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER:

1. The avcastcontroller parameter is nullptr.

2. The callback parameter is nullptr.

[h2]OH_AVCastController_UnregisterErrorCallback()

AVSession_ErrCode OH_AVCastController_UnregisterErrorCallback(OH_AVCastController* avcastcontroller, OH_AVCastControllerCallback_Error callback)

Description

Requests to unregister a callback for the playback error event.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.
OH_AVCastControllerCallback_Error callback Callback to unregister.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER:

1. The avcastcontroller parameter is nullptr.

2. The callback parameter is nullptr.

[h2]OH_AVCastController_SendCommonCommand()

AVSession_ErrCode OH_AVCastController_SendCommonCommand(OH_AVCastController* avcastcontroller, AVSession_AVCastControlCommandType* avCastControlcommand)

Description

Requests to send a common command to the remote device. Only commands such as play, pause, stop, next, and previous are supported.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.
AVSession_AVCastControlCommandType* avCastControlcommand Pointer to the control command.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER: The avcastcontroller parameter is nullptr.

AV_SESSION_ERR_CODE_COMMAND_INVALID: The avCastControlcommand parameter is invalid.

AV_SESSION_ERR_CODE_REMOTE_CONNECTION_NOT_EXIST: The remote connection is not established.

[h2]OH_AVCastController_SendSeekCommand()

AVSession_ErrCode OH_AVCastController_SendSeekCommand(OH_AVCastController* avcastcontroller, int32_t seekTimeMS)

Description

Requests to send a seek command to the remote device.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.
int32_t seekTimeMS Seek time, in milliseconds.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER:

1. The avcastcontroller parameter is nullptr.

2. The seekTimeMS parameter is invalid.

AV_SESSION_ERR_CODE_REMOTE_CONNECTION_NOT_EXIST: The remote connection is not established.

[h2]OH_AVCastController_SendFastForwardCommand()

AVSession_ErrCode OH_AVCastController_SendFastForwardCommand(OH_AVCastController* avcastcontroller, int32_t forwardTimeS)

Description

Requests to send a fast-forward command to the remote device.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.
int32_t forwardTimeS Fast-forward time, in seconds.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER:

1. The avcastcontroller parameter is nullptr.

2. The forwardTimeS parameter is invalid.

AV_SESSION_ERR_CODE_REMOTE_CONNECTION_NOT_EXIST: The remote connection is not established.

[h2]OH_AVCastController_SendRewindCommand()

AVSession_ErrCode OH_AVCastController_SendRewindCommand(OH_AVCastController* avcastcontroller, int32_t rewindTimeS)

Description

Requests to send a rewind command to the remote device.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.
int32_t rewindTimeS Rewind time, in seconds.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER:

1. The avcastcontroller parameter is nullptr.

2. The rewindTimeS parameter is invalid.

AV_SESSION_ERR_CODE_REMOTE_CONNECTION_NOT_EXIST: The remote connection is not established.

[h2]OH_AVCastController_SendSetSpeedCommand()

AVSession_ErrCode OH_AVCastController_SendSetSpeedCommand(OH_AVCastController* avcastcontroller, AVSession_PlaybackSpeed speed)

Description

Requests to send a speed setting command to the remote device.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.
AVSession_PlaybackSpeed speed Speed control command.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER:

1. The avcastcontroller parameter is nullptr.

2. The speed parameter is invalid.

AV_SESSION_ERR_CODE_REMOTE_CONNECTION_NOT_EXIST: The remote connection is not established.

[h2]OH_AVCastController_SendVolumeCommand()

AVSession_ErrCode OH_AVCastController_SendVolumeCommand(OH_AVCastController* avcastcontroller, int32_t volume)

Description

Requests to send a volume control command to the remote device.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.
int32_t volume Volume.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER:

1. The avcastcontroller parameter is nullptr.

2. The volume parameter is invalid.

AV_SESSION_ERR_CODE_REMOTE_CONNECTION_NOT_EXIST: The remote connection is not established.

[h2]OH_AVCastController_Prepare()

AVSession_ErrCode OH_AVCastController_Prepare(OH_AVCastController* avcastcontroller, OH_AVSession_AVQueueItem* avqueueItem)

Description

Requests to prepare the current audio or video playback queue item. This operation is a prerequisite for displaying output media information.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.
OH_AVSession_AVQueueItem* avqueueItem Pointer to the audio and video queue item.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER:

1. The avcastcontroller parameter is nullptr.

2. The avqueueItem parameter is nullptr.

AV_SESSION_ERR_CODE_REMOTE_CONNECTION_NOT_EXIST: The remote connection is not established.

[h2]OH_AVCastController_Start()

AVSession_ErrCode OH_AVCastController_Start(OH_AVCastController* avcastcontroller, OH_AVSession_AVQueueItem* avqueueItem)

Description

Requests to play the current item. The parameter should contain media resources; otherwise, playback will fail.

Since: 23

Parameters

Name Description
OH_AVCastController* avcastcontroller Pointer to the instance object of the playback controller.
OH_AVSession_AVQueueItem* avqueueItem Pointer to the audio and video queue item.

Return value

Type Description
AVSession_ErrCode

AV_SESSION_ERR_SUCCESS: The function is executed successfully.

AV_SESSION_ERR_SERVICE_EXCEPTION: Internal server error.

AV_SESSION_ERR_INVALID_PARAMETER:

1. The avcastcontroller parameter is nullptr.

2. The avqueueItem parameter is nullptr.