未验证 提交 e17d3f1d 编写于 作者: O openharmony_ci 提交者: Gitee

!24114 媒体子系统播放框架ArkTs问题整改

Merge pull request !24114 from FULIZHONG/0906flz
...@@ -1673,7 +1673,7 @@ avPlayer.off('audioInterrupt') ...@@ -1673,7 +1673,7 @@ avPlayer.off('audioInterrupt')
```ts ```ts
import media from '@ohos.multimedia.media' import media from '@ohos.multimedia.media'
printfItemDescription(obj: media.MediaDescription, key: string) { function printfItemDescription(obj: media.MediaDescription, key: string) {
let property: Object = obj[key]; let property: Object = obj[key];
console.info('audio key is ' + key); // 通过key值获取对应的value。key值具体可见[MediaDescriptionKey] console.info('audio key is ' + key); // 通过key值获取对应的value。key值具体可见[MediaDescriptionKey]
console.info('audio value is ' + property); //对应key值得value。其类型可为任意类型,具体key对应value的类型可参考[MediaDescriptionKey] console.info('audio value is ' + property); //对应key值得value。其类型可为任意类型,具体key对应value的类型可参考[MediaDescriptionKey]
...@@ -1682,7 +1682,7 @@ printfItemDescription(obj: media.MediaDescription, key: string) { ...@@ -1682,7 +1682,7 @@ printfItemDescription(obj: media.MediaDescription, key: string) {
avPlayer.getTrackDescription((error: BusinessError, arrList: Array<media.MediaDescription>) => { avPlayer.getTrackDescription((error: BusinessError, arrList: Array<media.MediaDescription>) => {
if (arrList != null) { if (arrList != null) {
for (let i = 0; i < arrList.length; i++) { for (let i = 0; i < arrList.length; i++) {
this.printfItemDescription(arrList[i], media.MediaDescriptionKey.MD_KEY_TRACK_TYPE); //打印出每条轨道MD_KEY_TRACK_TYPE的值 printfItemDescription(arrList[i], media.MediaDescriptionKey.MD_KEY_TRACK_TYPE); //打印出每条轨道MD_KEY_TRACK_TYPE的值
} }
} else { } else {
console.log(`audio getTrackDescription fail, error:${error}`); console.log(`audio getTrackDescription fail, error:${error}`);
...@@ -3480,7 +3480,7 @@ createAudioRecorder(): AudioRecorder ...@@ -3480,7 +3480,7 @@ createAudioRecorder(): AudioRecorder
**示例:** **示例:**
```ts ```ts
let audioRecorder = media.createAudioRecorder(); let audioRecorder: media.AudioRecorder = media.createAudioRecorder();
``` ```
## MediaErrorCode<sup>(deprecated)</sup><a name=mediaerrorcode></a> ## MediaErrorCode<sup>(deprecated)</sup><a name=mediaerrorcode></a>
...@@ -3920,7 +3920,7 @@ setDisplaySurface(surfaceId: string, callback: AsyncCallback\<void>): void ...@@ -3920,7 +3920,7 @@ setDisplaySurface(surfaceId: string, callback: AsyncCallback\<void>): void
**示例:** **示例:**
```ts ```ts
let surfaceId: string = null; let surfaceId: string = '';
videoPlayer.setDisplaySurface(surfaceId, (err: BusinessError) => { videoPlayer.setDisplaySurface(surfaceId, (err: BusinessError) => {
if (err == null) { if (err == null) {
console.info('setDisplaySurface success!'); console.info('setDisplaySurface success!');
...@@ -3955,7 +3955,7 @@ setDisplaySurface(surfaceId: string): Promise\<void> ...@@ -3955,7 +3955,7 @@ setDisplaySurface(surfaceId: string): Promise\<void>
**示例:** **示例:**
```ts ```ts
let surfaceId = null; let surfaceId: string = '';
videoPlayer.setDisplaySurface(surfaceId).then(() => { videoPlayer.setDisplaySurface(surfaceId).then(() => {
console.info('setDisplaySurface success'); console.info('setDisplaySurface success');
}).catch((error: BusinessError) => { }).catch((error: BusinessError) => {
...@@ -4299,7 +4299,7 @@ import media from '@ohos.multimedia.media' ...@@ -4299,7 +4299,7 @@ import media from '@ohos.multimedia.media'
let seekTime: number = 5000; let seekTime: number = 5000;
videoPlayer.seek(seekTime).then((seekDoneTime: number) => { // seekDoneTime表示seek完成后的时间点 videoPlayer.seek(seekTime).then((seekDoneTime: number) => { // seekDoneTime表示seek完成后的时间点
console.info('seek success'); console.info('seek success');
}).catch((error) => { }).catch((error: BusinessError) => {
console.error(`video catchCallback, error:${error}`); console.error(`video catchCallback, error:${error}`);
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册