未验证 提交 1d0e46a1 编写于 作者: S shuboxu 提交者: Gitee

update en/application-dev/media/video-recording.md.

Signed-off-by: Nshuboxu <xushubo1@huawei.com>
上级 6586b9bc
...@@ -62,21 +62,7 @@ Read [AVRecorder](../reference/apis/js-apis-media.md#avrecorder9) for the API re ...@@ -62,21 +62,7 @@ Read [AVRecorder](../reference/apis/js-apis-media.md#avrecorder9) for the API re
> - The recording output URL (URL in **avConfig** in the sample code) must be in the format of fd://xx (where xx indicates a file descriptor). You must call [ohos.file.fs](../reference/apis/js-apis-file-fs.md) to implement access to the application file. For details, see [Application File Access and Management](../file-management/app-file-access.md). > - The recording output URL (URL in **avConfig** in the sample code) must be in the format of fd://xx (where xx indicates a file descriptor). You must call [ohos.file.fs](../reference/apis/js-apis-file-fs.md) to implement access to the application file. For details, see [Application File Access and Management](../file-management/app-file-access.md).
```ts ```ts
class AVProfile { let avProfile: media.AVRecorderProfile = {
fileFormat: media.ContainerFormatType;
videoBitrate: number;
videoCodec: media.CodecMimeType;
videoFrameWidth: number;
videoFrameHeight: number;
videoFrameRate: number;
}
class AVConfig {
videoSourceType: media.VideoSourceType;
profile: AVProfile;
url: string;
rotation: number;
}
let avProfile: AVProfile = {
fileFormat: media.ContainerFormatType.CFT_MPEG_4, // Video file encapsulation format. Only MP4 is supported. fileFormat: media.ContainerFormatType.CFT_MPEG_4, // Video file encapsulation format. Only MP4 is supported.
videoBitrate: 200000, // Video bit rate. videoBitrate: 200000, // Video bit rate.
videoCodec: media.CodecMimeType.VIDEO_AVC, // Video file encoding format. Both MPEG-4 and AVC are supported. videoCodec: media.CodecMimeType.VIDEO_AVC, // Video file encoding format. Both MPEG-4 and AVC are supported.
...@@ -84,7 +70,7 @@ Read [AVRecorder](../reference/apis/js-apis-media.md#avrecorder9) for the API re ...@@ -84,7 +70,7 @@ Read [AVRecorder](../reference/apis/js-apis-media.md#avrecorder9) for the API re
videoFrameHeight: 480, // Video frame height. videoFrameHeight: 480, // Video frame height.
videoFrameRate: 30 // Video frame rate. videoFrameRate: 30 // Video frame rate.
} }
let avConfig: AVConfig = { let avConfig: media.AVRecorderConfig = {
videoSourceType: media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, // Video source type. YUV and ES are supported. videoSourceType: media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, // Video source type. YUV and ES are supported.
profile : avProfile, profile : avProfile,
url: 'fd://35', // Create, read, and write a file by referring to the sample code in Application File Access and Management. url: 'fd://35', // Create, read, and write a file by referring to the sample code in Application File Access and Management.
...@@ -139,24 +125,10 @@ Refer to the sample code below to complete the process of starting, pausing, res ...@@ -139,24 +125,10 @@ Refer to the sample code below to complete the process of starting, pausing, res
import media from '@ohos.multimedia.media' import media from '@ohos.multimedia.media'
import { BusinessError } from '@ohos.base'; import { BusinessError } from '@ohos.base';
const TAG = 'VideoRecorderDemo:' const TAG = 'VideoRecorderDemo:'
class AVProfile {
fileFormat: media.ContainerFormatType;
videoBitrate: number;
videoCodec: media.CodecMimeType;
videoFrameWidth: number;
videoFrameHeight: number;
videoFrameRate: number;
}
class AVConfig {
videoSourceType: media.VideoSourceType;
profile: AVProfile;
url: string;
rotation: number;
}
export class VideoRecorderDemo { export class VideoRecorderDemo {
private avRecorder: media.AVRecorder; private avRecorder: media.AVRecorder;
private videoOutSurfaceId: string; private videoOutSurfaceId: string;
private avProfile: AVProfile = { private avProfile: media.AVRecorderProfile = {
fileFormat: media.ContainerFormatType.CFT_MPEG_4, // Video file encapsulation format. Only MP4 is supported. fileFormat: media.ContainerFormatType.CFT_MPEG_4, // Video file encapsulation format. Only MP4 is supported.
videoBitrate: 100000, // Video bit rate. videoBitrate: 100000, // Video bit rate.
videoCodec: media.CodecMimeType.VIDEO_AVC, // Video file encoding format. Both MPEG-4 and AVC are supported. videoCodec: media.CodecMimeType.VIDEO_AVC, // Video file encoding format. Both MPEG-4 and AVC are supported.
...@@ -164,7 +136,7 @@ export class VideoRecorderDemo { ...@@ -164,7 +136,7 @@ export class VideoRecorderDemo {
videoFrameHeight: 480, // Video frame height. videoFrameHeight: 480, // Video frame height.
videoFrameRate: 30 // Video frame rate. videoFrameRate: 30 // Video frame rate.
} }
private avConfig: AVConfig = { private avConfig: media.AVRecorderConfig = {
videoSourceType: media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, // Video source type. YUV and ES are supported. videoSourceType: media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, // Video source type. YUV and ES are supported.
profile : this.avProfile, profile : this.avProfile,
url: 'fd://35', // Create, read, and write a file by referring to the sample code in Application File Access and Management. url: 'fd://35', // Create, read, and write a file by referring to the sample code in Application File Access and Management.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册