• Home
Name Date Size #Lines LOC

..--

AppScope/12-May-2024-3633

entry/12-May-2024-2,4982,144

screenshots/devices/12-May-2024-

.gitignoreD12-May-2024121 88

README.mdD12-May-20241.8 KiB2412

README_zh.mdD12-May-20242.7 KiB4827

build-profile.json5D12-May-20241 KiB4341

hvigorfile.jsD12-May-2024168 21

package.jsonD12-May-2024374 1918

README.md

1# Multimedia - Camera and Media Library
2
3### Introduction
4
5 This demo shows how to invoke the camera to take photos and record videos in eTS and how to use the **MediaLibrary** APIs to add, delete, modify, and query media files.
6
7### Usage
8
91. Start the demo app. After the user grants the permission, the home screen of the app displays the album information of the current device. It also listens for the album changes and updates the album information.
10
112. Touch **+** to display the camera, record, and text icons.
12
133. Touch the camera icon to enter the camera screen. By default, the camera mode is used. Touch the capture button at the bottom to take a photo. After the photo is taken, the preview image is displayed on the left at the bottom. Touch the video icon to switch to the video recording mode. Touch the button at the bottom to start video recording and touch the end button to stop recording. After the recording is complete, the video icon is displayed on the left at the bottom. Touch the system **Back** button or **Back** on the top of the page to return to the home screen.
14
15
164. Touch the record icon to enter the recording screen. Touch the **Start** button on the right to start recording. The button changes to the **Pause** button. Touch the button to pause or resume recording. Touch the **End** button on the left to stop recording and return to the home screen.
17
185. Touch the text icon to enter the text editing page. Enter the text content and touch **Save**. A text file is created, and then the home screen is displayed.
19
206. Touch the album to access the file list screen. The files in the album are displayed. The list contains the **Delete** and **Rename** buttons. You can touch a file to delete or rename it.
21### Constraints
22
23This sample can only be run on standard-system devices.
24

README_zh.md

1# 相机和媒体库
2
3### 简介
4
5此Demo展示如何在eTS中调用相机拍照和录像,以及如何使用媒体库接口进行媒体文件的增、删、改、查操作。实现效果如下:
6
7![main](screenshots/devices/main.png)
8
9### 相关概念
10
11媒体库管理:媒体库管理提供接口对公共媒体资源文件进行管理,包括文件的增、删、改、查等。
12相机:相机模块支持相机相关基础功能的开发,主要包括预览、拍照、录像等。。
13
14### 相关权限
15
16相机权限:ohos.permission.CAMERA
17麦克风权限:ohos.permission.MICROPHONE
18访问媒体文件地理位置信息权限:ohos.permission.MEDIA_LOCATION
19读取公共媒体文件权限:ohos.permission.READ_MEDIA
20读写公共媒体文件权限:ohos.permission.WRITE_MEDIA
21
22### 使用说明
23
241.启动应用,在权限弹窗中授权后返回应用,首页显示当前设备的相册信息,首页监听相册变化会刷新相册列表。
25
262.点击 **+** 按钮,弹出相机、录音、文本文件三个图标。
27
283.点击**相机**图标,进入相机界面,默认是拍照模式,点击底部拍照按钮可以拍照,拍照完成会在底部左侧显示照片预览图。点击**录像**切换到录像模式,点击底部按钮开始录像,点击结束按钮结束录像,结束录像后底部左侧显示视频图标。点击系统**Back**键或界面顶部**返回**按钮返回首页。
29
304.点击**录音**图标进入录音界面,点击右侧**开始**按钮开始录音,按钮变为暂停按钮,点击可以暂停和继续录音,点击左侧**结束**按钮结束录音返回首页。
31
325.点击**文本**图标进入文本编辑界面,输入文本内容后点击**Save**按钮,会创建并写入文本文件,完成后返回首页。
33
346.点击相册进入文件列表界面,展示相册内的文件,列表中有**删除**和**重命名**按钮,点击可以删除文件和重命名文件。
35
367.安装视频播放VideoPlayer应用后,点击视频文件可以调起视频播放界面播放该视频。
37
38### 约束与限制
39
401.rk3568底层录像功能有问题,暂不支持录像功能,当前拍照功能仅支持部分机型。
41
422.本示例仅支持标准系统上运行。
43
443.本示例为Stage模型,从API version 9开始支持。
45
464.本示例需要使用DevEco Studio 3.0 Beta4 (Build Version: 3.0.0.992, built on July 14, 2022)才可编译运行。
47
485.本示例需要使用@ohos.multimedia.mediaLibrary系统权限的系统接口。使用Full SDK时需要手动从镜像站点获取,并在DevEco Studio中替换,具体操作可参考[替换指南](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/full-sdk-switch-guide.md)