openharmony 鸿蒙 arkts-apis-avsession-e

2026-08-25 浏览 (1)

Enums

NOTE

The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.

ProtocolType11+

Enumerates the protocol types supported by the remote device.

System capability: SystemCapability.Multimedia.AVSession.AVCast

NameValueDescription
TYPE_LOCAL11+0Local device, which can be the built-in speaker or audio jack of the device, or an A2DP device.
Atomic service API: This API can be used in atomic services since API version 12.
TYPE_CAST_PLUS_STREAM11+2Cast+ stream mode, indicating that the media asset is being displayed on another device.
Atomic service API: This API can be used in atomic services since API version 12.
TYPE_DLNA12+4DLNA protocol, indicating that the media asset is being displayed on another device.
Atomic service API: This API can be used in atomic services since API version 12.
TYPE_CAST_PLUS_AUDIO20+8PCM mode, indicating that the media asset is being displayed on another device.
Atomic service API: This API can be used in atomic services since API version 20.

CastDisplayState12+

Enumerates the states of the cast display.

Atomic service API: This API can be used in atomic services since API version 12.

System capability: SystemCapability.Multimedia.AVSession.ExtendedDisplayCast

NameValueDescription
STATE_OFF1The device is disconnected, and the extended screen does not display any content.
STATE_ON2The device is connected, and the extended screen is available.

CallerType22+

Enumerates the types of sources for the caller.

System capability: SystemCapability.Multimedia.AVSession.Core

NameValueDescription
TYPE_CAST"cast"The caller comes from casting.
TYPE_BLUETOOTH"bluetooth"The caller comes from Bluetooth.
TYPE_APP"app"The caller comes from an application.
TYPE_NEARLINK"nearlink"The caller comes from NearLink.
Model restriction: This API can be used only in the stage model.

ConnectionState10+

Enumerates the connection states.

Atomic service API: This API can be used in atomic services since API version 12.

System capability: SystemCapability.Multimedia.AVSession.Core

NameValueDescription
STATE_CONNECTING0The device is connecting.
STATE_CONNECTED1The device is connected.
STATE_DISCONNECTED6The device is disconnected.

CallState11+

Enumerates the call states.

Atomic service API: This API can be used in atomic services since API version 12.

System capability: SystemCapability.Multimedia.AVSession.Core

NameValueDescription
CALL_STATE_IDLE0The phone is idle.
CALL_STATE_INCOMING1The phone is ringing.
CALL_STATE_ACTIVE2The call is connected.
CALL_STATE_DIALING3The caller is dialing.
CALL_STATE_WAITING4The call is waiting for connection.
CALL_STATE_HOLDING5The call is placed on hold.
CALL_STATE_DISCONNECTING6The call is disconnecting.

DisplayTag11+

Enumerates the display tags of the media asset. The display tag is a special type identifier of the media audio source.

System capability: SystemCapability.Multimedia.AVSession.Core

NameValueDescription
TAG_AUDIO_VIVID1AUDIO VIVID

DecoderType19+

Enumerates the decoding formats supported by the device.

Atomic service API: This API can be used in atomic services since API version 19.

System capability: SystemCapability.Multimedia.AVSession.AVCast

NameValueDescription
OH_AVCODEC_MIMETYPE_VIDEO_AVC"video/avc"VIDEO AVC.
OH_AVCODEC_MIMETYPE_VIDEO_HEVC"video/hevc"VIDEO HEVC.
OH_AVCODEC_MIMETYPE_AUDIO_VIVID"audio/av3a"AUDIO AV3A.

ResolutionLevel19+

Enumerates the resolution levels supported by the device.

Atomic service API: This API can be used in atomic services since API version 19.

System capability: SystemCapability.Multimedia.AVSession.AVCast

NameValueDescription
RESOLUTION_480P0480p (640 x 480 dpi).
RESOLUTION_720P1720p (1280 x 720 dpi).
RESOLUTION_1080P21080p (1920 x 1080 dpi).
RESOLUTION_2K32K (2560 x 1440 dpi).
RESOLUTION_4K44K (4096 x 3840 dpi).

AVCastCategory10+

Enumerates the cast categories.

Atomic service API: This API can be used in atomic services since API version 12.

System capability: SystemCapability.Multimedia.AVSession.AVCast

NameValueDescription
CATEGORY_LOCAL0Local playback. The sound is played from the local device or a connected Bluetooth headset by default.
CATEGORY_REMOTE1Remote playback. The sound or images are played from a remote device.

DeviceType10+

Enumerates the output device types.

Atomic service API: This API can be used in atomic services since API version 12.

NameValueDescription
DEVICE_TYPE_LOCAL0Local device.
System capability: SystemCapability.Multimedia.AVSession.Core
DEVICE_TYPE_BLUETOOTH10Bluetooth device.
System capability: SystemCapability.Multimedia.AVSession.Core
DEVICE_TYPE_TV2TV.
System capability: SystemCapability.Multimedia.AVSession.AVCast
DEVICE_TYPE_SMART_SPEAKER3Speaker.
System capability: SystemCapability.Multimedia.AVSession.AVCast

LoopMode10+

Enumerates the loop modes of media playback.

Atomic service API: This API can be used in atomic services since API version 12.

System capability: SystemCapability.Multimedia.AVSession.Core

NameValueDescription
LOOP_MODE_SEQUENCE0Sequential playback.
LOOP_MODE_SINGLE1Single loop.
LOOP_MODE_LIST2Playlist loop.
LOOP_MODE_SHUFFLE3Shuffle.
LOOP_MODE_CUSTOM11+4Custom playback.

PlaybackState10+

Enumerates the media playback states.

Atomic service API: This API can be used in atomic services since API version 12.

System capability: SystemCapability.Multimedia.AVSession.Core

NameValueDescription
PLAYBACK_STATE_INITIAL0Initial.
PLAYBACK_STATE_PREPARE1Preparing.
PLAYBACK_STATE_PLAY2Playing.
PLAYBACK_STATE_PAUSE3Paused.
PLAYBACK_STATE_FAST_FORWARD4Fast-forwarding.
PLAYBACK_STATE_REWIND5Rewinding.
PLAYBACK_STATE_STOP6Stopped.
PLAYBACK_STATE_COMPLETED7Playback complete.
PLAYBACK_STATE_RELEASED8Released.
PLAYBACK_STATE_ERROR9Error.
PLAYBACK_STATE_IDLE11+10Idle.
PLAYBACK_STATE_BUFFERING11+11Buffering.

AVSessionErrorCode10+

Enumerates the error codes used in the media session.

NameValueDescription
ERR_CODE_SERVICE_EXCEPTION6600101The session server is abnormal.
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.Multimedia.AVSession.Core
ERR_CODE_SESSION_NOT_EXIST6600102The session does not exist.
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.Multimedia.AVSession.Core
ERR_CODE_CONTROLLER_NOT_EXIST6600103The session controller does not exist.
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.Multimedia.AVSession.Core
ERR_CODE_REMOTE_CONNECTION_ERR6600104Connection to the remote session fails.
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.Multimedia.AVSession.Core
ERR_CODE_COMMAND_INVALID6600105The session command is invalid.
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.Multimedia.AVSession.Core
ERR_CODE_SESSION_INACTIVE6600106The session is not activated.
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.Multimedia.AVSession.Core
ERR_CODE_MESSAGE_OVERLOAD6600107Too many commands or messages.
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.Multimedia.AVSession.Core
ERR_CODE_DEVICE_CONNECTION_FAILED6600108Connection to the device fails.
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.Multimedia.AVSession.Core
ERR_CODE_REMOTE_CONNECTION_NOT_EXIST6600109The remote session does not exist.
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.Multimedia.AVSession.Core
ERR_CODE_CAST_CONTROL_UNSPECIFIED13+6611000An undefined error occurs during cast control.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_REMOTE_ERROR13+6611001An unknown error occurs in the remote player.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_BEHIND_LIVE_WINDOW13+6611002The playback is delayed.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_TIMEOUT13+6611003The cast control process times out.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_RUNTIME_CHECK_FAILED13+6611004The runtime check fails.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_PLAYER_NOT_WORKING13+6611100Cross-device data transfer is locked.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_SEEK_MODE_UNSUPPORTED13+6611101The specified seek mode is not supported.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_ILLEGAL_SEEK_TARGET13+6611102The seek position is out of the media range, or the current seek mode is not supported.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_PLAY_MODE_UNSUPPORTED13+6611103The specified playback mode is not supported.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_PLAY_SPEED_UNSUPPORTED13+6611104The specified playback speed is not supported.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_DEVICE_MISSING13+6611105Operation failed because the media source device or media receiver device has been destroyed.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_INVALID_PARAM13+6611106The parameter is invalid.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_NO_MEMORY13+6611107Failed to allocate memory.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_OPERATION_NOT_ALLOWED13+6611108The operation is not allowed.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_IO_UNSPECIFIED13+6612000An unspecified input/output error occurs.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_IO_NETWORK_CONNECTION_FAILED13+6612001Network connection fails.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_IO_NETWORK_CONNECTION_TIMEOUT13+6612002Network connection times out.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_IO_INVALID_HTTP_CONTENT_TYPE 13+6612003The value of Content-Type is invalid.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_IO_BAD_HTTP_STATUS13+6612004The HTTP server returns an unexpected HTTP response status code.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_IO_FILE_NOT_FOUND13+6612005The file does not exist.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_IO_NO_PERMISSION13+6612006The input/output operation is not allowed.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_IO_CLEARTEXT_NOT_PERMITTED13+6612007The network security configuration of the application does not allow access to plaintext HTTP traffic.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_IO_READ_POSITION_OUT_OF_RANGE13+6612008Data is read from data binding.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_IO_NO_CONTENTS13+6612100No content can be played in the media.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_IO_READ_ERROR13+6612101The media cannot be read.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_IO_CONTENT_BUSY13+6612102The resource is in use.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_IO_CONTENT_EXPIRED13+6612103The input/output request content has expired.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_IO_USE_FORBIDDEN13+6612104The requested content cannot be played.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_IO_NOT_VERIFIED13+6612105The allowed content cannot be verified.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_IO_EXHAUSTED_ALLOWED_USES13+6612106The number of times that the content can be used has reached the maximum.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_IO_NETWORK_PACKET_SENDING_FAILED13+6612107An error occurs when the source device sends data packets to the destination device.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_PARSING_UNSPECIFIED13+6613000An unspecified content parsing error occurs.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_PARSING_CONTAINER_MALFORMED13+6613001The format of the media container bit stream is incorrectly parsed.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_PARSING_MANIFEST_MALFORMED13+6613002An error occurred when parsing the media list.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_PARSING_CONTAINER_UNSUPPORTED13+6613003The media container format or feature of the file is not supported.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_PARSING_MANIFEST_UNSUPPORTED13+6613004The feature is not supported in the media list.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_DECODING_UNSPECIFIED13+6614000An unspecified decoding error occurs.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_DECODING_INIT_FAILED13+6614001Initializing the decoder fails.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_DECODING_QUERY_FAILED13+6614002Querying the decoder fails.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_DECODING_FAILED13+6614003Decoding the media sample fails.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_DECODING_FORMAT_EXCEEDS_CAPABILITIES13+6614004The device cannot decode the current format.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_DECODING_FORMAT_UNSUPPORTED13+6614005The decoding format is not supported.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_AUDIO_RENDERER_UNSPECIFIED13+6615000An unspecified audio renderer error occurs.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_AUDIO_RENDERER_INIT_FAILED 13+6615001Initializing the audio renderer fails.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_AUDIO_RENDERER_WRITE_FAILED13+6615002Writing data to the audio renderer fails.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_DRM_UNSPECIFIED13+6616000An unspecified DRM-related error occurs.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_DRM_SCHEME_UNSUPPORTED13+6616001The device does not support the selected DRM scheme.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_DRM_PROVISIONING_FAILED13+6616002Device configurations fail.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_DRM_CONTENT_ERROR13+6616003The DRM-protected content cannot be played.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_DRM_LICENSE_ACQUISITION_FAILED13+6616004Obtaining a license fails.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_DRM_DISALLOWED_OPERATION13+6616005The license policy does not allow this operation.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_DRM_SYSTEM_ERROR13+6616006An error occurs in the DRM system.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_DRM_DEVICE_REVOKED13+6616007The DRM permission has been revoked from the device.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_DRM_LICENSE_EXPIRED13+6616008The DRM license that is being loaded has expired.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast
ERR_CODE_CAST_CONTROL_DRM_PROVIDE_KEY_RESPONSE_ERROR13+6616100An error occurs when the DRM processes the key response.
Atomic service API: This API can be used in atomic services since API version 13.
System capability: SystemCapability.Multimedia.AVSession.AVCast

SkipIntervals11+

Enumerates the fast-forward or rewind intervals supported by the media session.

System capability: SystemCapability.Multimedia.AVSession.Core

NameValueDescription
SECONDS_1010The time is 10 seconds.
SECONDS_1515The time is 15 seconds.
SECONDS_3030The time is 30 seconds.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 arkts-apis-avsession

openharmony 鸿蒙 capi-native-avsession-h

openharmony 鸿蒙 errorcode-avsession

openharmony 鸿蒙 js-apis-inner-application-MediaControlExtensionContext-sys

openharmony 鸿蒙 arkts-apis-avsession-AVSession

openharmony 鸿蒙 ohos-multimedia-avcastpicker

openharmony 鸿蒙 arkts-apis-avsession-AVCastController

openharmony 鸿蒙 arkts-apis-avsession-AVCastPickerHelper

openharmony 鸿蒙 capi-native-avmetadata-h

openharmony 鸿蒙 arkts-apis-avsession-t

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/MmLjiERL