openharmony 鸿蒙 arkts-apis-avsession-i

2026-08-25 浏览 (1)

Interfaces (Others)

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.

AVCastControlCommand10+

Describes the command that can be sent by a cast controller.

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

System capability: SystemCapability.Multimedia.AVSession.AVCast

NameTypeRead-OnlyOptionalDescription
commandAVCastControlCommandTypeNoNoCommand. The parameters carried in each command are different. For details, see AVCastControlCommandType.
parametermedia.PlaybackSpeed | number | string | LoopModeNoYesParameters carried in the command.

CastDisplayInfo12+

Describes the information about the cast display in the case of extended screens.

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

System capability: SystemCapability.Multimedia.AVSession.ExtendedDisplayCast

NameTypeRead-OnlyOptionalDescription
idnumberNoNoID of the cast display. The value must be an integer.
namestringNoNoName of the cast display.
stateCastDisplayStateNoNoState of the cast display.
widthnumberNoNoScreen width of the cast display, in px. The value must be an integer.
heightnumberNoNoScreen height of the cast display, in px. The value must be an integer.

AVMetadata10+

Describes the media metadata.

System capability: SystemCapability.Multimedia.AVSession.Core

NameTypeRead-OnlyOptionalDescription
assetIdstringNoNoMedia asset ID. It is the unique ID of a song and defined by the application. If this property changes, all other metadata properties will be refreshed.
Atomic service API: This API can be used in atomic services since API version 12.
titlestringNoYesTitle.
Atomic service API: This API can be used in atomic services since API version 12.
artiststringNoYesArtist.
Atomic service API: This API can be used in atomic services since API version 12.
authorstringNoYesAuthor.
Atomic service API: This API can be used in atomic services since API version 12.
avQueueName12+stringNoYesPlaylist name.
avQueueId11+stringNoYesUnique ID of the playlist.
avQueueImage11+image.PixelMap | stringNoYesCover image of the playlist,
which can be pixel data of an image or an image path (local path or Internet path). Applications call setAVMetadata to set the image data.
- If the data type is set to PixelMap, the data obtained by calling getAVMetadata is the pixel data of an image.
- If the data type is set to url, the data obtained is an image path.
albumstringNoYesAlbum name.
Atomic service API: This API can be used in atomic services since API version 12.
writerstringNoYesWriter.
Atomic service API: This API can be used in atomic services since API version 12.
composerstringNoYescomposer.
durationnumberNoYesMedia duration, in ms.
Atomic service API: This API can be used in atomic services since API version 12.
mediaImageimage.PixelMap | stringNoYesPixel map or image path (local path or network path) of the image. Applications call setAVMetadata to set the image data.
- If the data type is set to PixelMap, the data obtained by calling getAVMetadata is the pixel data of an image.
- If the data type is set to url, the data obtained is an image path.
Atomic service API: This API can be used in atomic services since API version 12.
bundleIcon18+image.PixelMapYesYesPixel data of the image that is used as the application icon. It is read-only and cannot be set on the application side.
publishDateDateNoYesRelease date.
subtitlestringNoYesSubtitle.
Atomic service API: This API can be used in atomic services since API version 12.
descriptionstringNoYesMedia description.
Atomic service API: This API can be used in atomic services since API version 12.
lyricstringNoYesLyrics. The application needs to combine the lyrics into a string.
The string length must be less than 40960 bytes.
NOTE: The system supports lyrics in the simple LRC format. If the lyrics are not standard (for example, having duplicate timestamps), the lyrics fail to be parsed and cannot be displayed properly in the system.
singleLyricText17+stringNoYesLyrics of a single media asset. The application must combine the lyrics into a string (excluding the timestamp).
The string length must be less than 40960 bytes.
Atomic service API: This API can be used in atomic services since API version 17.
previousAssetIdstringNoYesID of the previous media asset.
Atomic service API: This API can be used in atomic services since API version 12.
nextAssetIdstringNoYesID of the next media asset.
Atomic service API: This API can be used in atomic services since API version 12.
filter11+numberNoYesProtocol supported by the media session. The default value is TYPE_CAST_PLUS_STREAM. For details, see ProtocolType.
Atomic service API: This API can be used in atomic services since API version 12.
drmSchemes12+Array<string>NoYesDRM scheme supported by the media session. The value is the UUID of the DRM scheme.
skipIntervals11+SkipIntervalsNoYesIntervals supported for fast-forwarding and rewinding. The default value is SECONDS_15, that is, 15 seconds.
displayTags11+numberNoYesDisplay tags of the media asset. For details, see DisplayTag.

AVMediaDescription10+

Describes the properties related to the media metadata in the playlist.

NameTypeRead-OnlyOptionalDescription
assetIdstringNoNoMedia ID in the playlist.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 12.
titlestringNoYesName of the media asset in the playlist.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 12.
subtitlestringNoYesSubname of the media asset in the playlist. This property is not supported in audio casting scenarios where the Cast+ protocol is used.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 12.
descriptionstringNoYesDescription of the media asset in the playlist.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 12.
mediaImageimage.PixelMap |stringNoYesPixel map of the image of the media asset in the playlist. This property is not supported in audio casting scenarios where the Cast+ protocol is used.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 12.
extrasRecord<string, Object>NoYesAdditional fields of the media asset in the playlist.
NOTE
Since API version 20, the parameter type is changed to Record<string, Object>. In API version 19 and earlier, the parameter type is {[key: string]: Object}, which can still be used without adaptation.
System capability: SystemCapability.Multimedia.AVSession.Core
mediaUristringNoYesURI of the media asset in the playlist.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 12.
mediaTypestringNoYesType of the media asset in the playlist.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 12.
mediaSizenumberNoYesSize of the media asset in the playlist.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 12.
albumTitlestringNoYesAlbum name of the media asset in the playlist.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 12.
albumCoverUristringNoYesURI of the album cover of the media asset in the playlist.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 12.
lyricContentstringNoYesLyric content of the media asset in the playlist.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 12.
lyricUristringNoYesLyric URI of the media asset in the playlist.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 12.
artiststringNoYesAuthor of the lyric of the media asset in the playlist.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 12.
fdSrcmedia.AVFileDescriptorNoYesHandle to the local media file in the playlist.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 12.
dataSrc12+media.AVDataSrcDescriptorNoYesDescriptor of the data source in the playlist.
System capability: SystemCapability.Multimedia.AVSession.Core
pcmSrc20+booleanNoYesWhether the playlist uses a PCM data source. true if the PCM data source used, false otherwise.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 20.
drmScheme12+stringNoYesDRM scheme supported by the playlist. The value is the UUID of the DRM scheme.
System capability: SystemCapability.Multimedia.AVSession.Core
durationnumberNoYesPlayback duration of the media asset in the playlist.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 12.
startPositionnumberNoYesStart position for playing the media asset in the playlist.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 12.
creditsPositionnumberNoYesPosition for playing the closing credits of the media asset in the playlist.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 12.
appNamestringNoYesName of the application provided by the playlist.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 12.
displayTags11+numberNoYesDisplay tags of the media asset. For details, see DisplayTag. This property is not supported in audio casting scenarios where the Cast+ protocol is used.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 12.
launchClientData20+stringNoYesCustom data sent by the application to the receiver during casting.
System capability: SystemCapability.Multimedia.AVSession.AVCast
Atomic service API: This API can be used in atomic services since API version 20.

AVQueueItem10+

Describes the properties of an item in the playlist.

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

System capability: SystemCapability.Multimedia.AVSession.Core

NameTypeRead-OnlyOptionalDescription
itemIdnumberNoNoID of an item in the playlist.
descriptionAVMediaDescriptionNoYesMedia metadata of the item in the playlist.

AVPlaybackState10+

Describes the information related to the media playback state.

System capability: SystemCapability.Multimedia.AVSession.Core

NameTypeRead-OnlyOptionalDescription
statePlaybackStateNoYesPlayback state.
Atomic service API: This API can be used in atomic services since API version 12.
speednumberNoYesPlayback speed.
Atomic service API: This API can be used in atomic services since API version 12.
positionPlaybackPositionNoYesPlayback position.
Atomic service API: This API can be used in atomic services since API version 12.
bufferedTimenumberNoYesBuffered time.
Atomic service API: This API can be used in atomic services since API version 12.
loopModeLoopModeNoYesLoop mode.
Atomic service API: This API can be used in atomic services since API version 12.
isFavoritebooleanNoYesWhether the media asset is marked as a favorite. true if marked, false otherwise.
Atomic service API: This API can be used in atomic services since API version 12.
activeItemIdnumberNoYesID of the item that is being played.
Atomic service API: This API can be used in atomic services since API version 12.
volumenumberNoYesMedia volume.
Atomic service API: This API can be used in atomic services since API version 12.
maxVolume11+numberNoYesMaximum volume.
Atomic service API: This API can be used in atomic services since API version 12.
muted11+booleanNoYesWhether the media asset is muted. true if muted, false otherwise.
Atomic service API: This API can be used in atomic services since API version 12.
duration11+numberNoYesDuration of the media asset.
videoWidth11+numberNoYesVideo width of the media asset, in px.
Atomic service API: This API can be used in atomic services since API version 12.
videoHeight11+numberNoYesVideo height of the media asset, in px.
Atomic service API: This API can be used in atomic services since API version 12.
extrasRecord<string, Object>NoYesCustom media data.
Atomic service API: This API can be used in atomic services since API version 12.

PlaybackPosition10+

Describes the information related to the playback position.

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

System capability: SystemCapability.Multimedia.AVSession.Core

NameTypeRead-OnlyOptionalDescription
elapsedTimenumberNoNoElapsed time, in ms.
updateTimenumberNoNoUpdated time, in ms.

CallMetadata11+

Describes the properties related to call metadata.

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

System capability: SystemCapability.Multimedia.AVSession.Core

NameTypeRead-OnlyOptionalDescription
namestringNoYesName (alias) of the caller.
phoneNumberstringNoYesPhone number of the caller.
avatarimage.PixelMapNoYesProfile picture of the caller.

AVCallState11+

Describes the properties related to the call state.

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

System capability: SystemCapability.Multimedia.AVSession.Core

NameTypeRead-OnlyOptionalDescription
stateCallStateNoNoCall state.
mutedbooleanNoNoWhether the microphone is muted. true if muted, false otherwise.

DeviceInfo10+

Describes the information related to the output device.

NameTypeRead-OnlyOptionalDescription
castCategoryAVCastCategoryNoNoCast category.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 12.
deviceIdstringNoNoID of the output device.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 12.
deviceNamestringNoNoName of the output device.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 12.
deviceTypeDeviceTypeNoNoType of the output device.
System capability: SystemCapability.Multimedia.AVSession.Core
Atomic service API: This API can be used in atomic services since API version 12.
supportedProtocols11+numberNoYesProtocol supported by the output device. The default value is TYPE_LOCAL. For details, see ProtocolType.
System capability: SystemCapability.Multimedia.AVSession.AVCast
Atomic service API: This API can be used in atomic services since API version 12.
supportedDrmCapabilities12+Array<string>NoYesDRM capability supported by the output device.
System capability: SystemCapability.Multimedia.AVSession.AVCast
Atomic service API: This API can be used in atomic services since API version 12.
manufacturer13+stringNoYesManufacturer of the output device.
System capability: SystemCapability.Multimedia.AVSession.AVCast
Atomic service API: This API can be used in atomic services since API version 13.
modelName13+stringNoYesModel name of the output device.
System capability: SystemCapability.Multimedia.AVSession.AVCast
Atomic service API: This API can be used in atomic services since API version 13.
audioCapabilities20+AudioCapabilitiesNoYesAudio capabilities supported by the output device.
System capability: SystemCapability.Multimedia.AVSession.AVCast
Atomic service API: This API can be used in atomic services since API version 20.
supportedPullClients20+Array<number>NoYesIDs of supported pull clients. (This field is returned only for devices that support 4K casting.)
System capability: SystemCapability.Multimedia.AVSession.AVCast
Atomic service API: This API can be used in atomic services since API version 20.

OutputDeviceInfo10+

Describes the information related to the output device.

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

System capability: SystemCapability.Multimedia.AVSession.Core

NameTypeRead-OnlyOptionalDescription
devicesArray<DeviceInfo>NoNoOutput devices.

AVControlCommand10+

Describes the command that can be sent to the session.

System capability: SystemCapability.Multimedia.AVSession.Core

NameTypeRead-OnlyOptionalDescription
commandAVControlCommandTypeNoNoCommand. (Different commands correspond to different parameters.)
Atomic service API: This API can be used in atomic services since API version 12.
parameterLoopMode |string | numberNoYesParameters carried in the command.
Atomic service API: This API can be used in atomic services since API version 12.
commandInfo22+CommandInfoNoYesCommand information.

AVCastPickerOptions14+

Describes the properties related to the semi-modal window that is started for casting purposes.

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

System capability: SystemCapability.Multimedia.AVSession.AVCast

NameTypeRead-OnlyOptionalDescription
sessionTypeAVSessionTypeNoYesSession type. The default value is audio.
Currently, only the audio and video session types are supported. If voice_call and video_call are passed, they are treated as the default value audio.

AudioCapabilities20+

Describes the audio capabilities supported by the casting device.

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

System capability: SystemCapability.Multimedia.AVSession.AVCast

NameTypeRead-OnlyOptionalDescription
streamInfosArray<audio.AudioStreamInfo>YesNoAudio capability parameters.

CommandInfo22+

Describes the command information to be sent to the session.

System capability: SystemCapability.Multimedia.AVSession.Core

NameTypeRead-OnlyOptionalDescription
callerBundleNamestringNoYesBundle name of the caller.
callerModuleNamestringNoYesModule name of the caller.
callerDeviceIdstringNoYesDevice IP address of the caller.
callerTypeCallerTypeNoYesSource of the caller.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 arkts-apis-avsession

openharmony 鸿蒙 arkts-apis-avsession-e

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

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