修复MediaCollections应用因接口下架导致的音视频播放问题

Signed-off-by: 王鑫 <wangxin601@huawei.com>
This commit is contained in:
王鑫 2024-06-28 17:25:54 +08:00
parent 125ca080f5
commit 0bd8eafd4e
130 changed files with 860 additions and 869 deletions

View File

@ -1,112 +0,0 @@
/*
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import { myMedia } from '../model/myMedia'
import { filterSize, getTimeString, getDateTime } from '../model/TimeTools'
@CustomDialog
export struct isInformationDialog {
@Link myMedia: myMedia
@State isInformation_id: string = ''
@State isInformation_uri: string = ''
@State isInformation_mimeType: string = ''
@State isInformation_mediaType: string = ''
@State isInformation_displayName: string = ''
@State isInformation_title: string = ''
@State isInformation_relativePath: string = ''
@State isInformation_parent: string = ''
@State isInformation_size: string = ''
@State isInformation_dateAdded: string = ''
@State isInformation_dateModified: string = ''
@State isInformation_dateTaken: string = ''
@State isInformation_artist: string = ''
@State isInformation_audioAlbum: string = ''
@State isInformation_width: string = ''
@State isInformation_height: string = ''
@State isInformation_orientation: string = ''
@State isInformation_duration: string = ''
@State isInformation_albumId: string = ''
@State isInformation_albumUri: string = ''
@State isInformation_albumName: string = ''
private controller: CustomDialogController = {} as CustomDialogController
private isInformation: mediaLibrary.FileAsset = {} as mediaLibrary.FileAsset
private scroller: Scroller = new Scroller()
private context: Context = getContext(this)
async aboutToAppear() {
this.myMedia.getPause()
this.isInformation = this.myMedia.getResourceAddress()
this.isInformation_id = await this.convertResourceToString($r('app.string.index_formation_id'))
this.isInformation_uri = await this.convertResourceToString($r('app.string.index_formation_uri'))
this.isInformation_mimeType = await this.convertResourceToString($r('app.string.index_formation_mimeType'))
this.isInformation_mediaType = await this.convertResourceToString($r('app.string.index_formation_mediaType'))
this.isInformation_displayName = await this.convertResourceToString($r('app.string.index_formation_displayName'))
this.isInformation_title = await this.convertResourceToString($r('app.string.index_formation_title'))
this.isInformation_relativePath = await this.convertResourceToString($r('app.string.index_formation_relativePath'))
this.isInformation_parent = await this.convertResourceToString($r('app.string.index_formation_parent'))
this.isInformation_size = await this.convertResourceToString($r('app.string.index_formation_size'))
this.isInformation_dateAdded = await this.convertResourceToString($r('app.string.index_formation_dateAdded'))
this.isInformation_dateModified = await this.convertResourceToString($r('app.string.index_formation_dateModified'))
this.isInformation_dateTaken = await this.convertResourceToString($r('app.string.index_formation_dateTaken'))
this.isInformation_artist = await this.convertResourceToString($r('app.string.index_formation_artist'))
this.isInformation_audioAlbum = await this.convertResourceToString($r('app.string.index_formation_audioAlbum'))
this.isInformation_width = await this.convertResourceToString($r('app.string.index_formation_width'))
this.isInformation_height = await this.convertResourceToString($r('app.string.index_formation_height'))
this.isInformation_orientation = await this.convertResourceToString($r('app.string.index_formation_orientation'))
this.isInformation_duration = await this.convertResourceToString($r('app.string.index_formation_duration'))
this.isInformation_albumId = await this.convertResourceToString($r('app.string.index_formation_albumId'))
this.isInformation_albumUri = await this.convertResourceToString($r('app.string.index_formation_albumUri'))
this.isInformation_albumName = await this.convertResourceToString($r('app.string.index_formation_albumName'))
}
async convertResourceToString(resource: Resource): Promise<string> {
return await this.context.resourceManager.getString(resource.id)
}
build() {
Scroll(this.scroller) {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceEvenly }) {
Text($r('app.string.index_formation')).fontColor('#FFFFFF')
Text(`${this.isInformation_id + this.isInformation.id}`).fontColor('#FFFFFF')
Text(`${this.isInformation_uri + this.isInformation.uri}`).fontColor('#FFFFFF')
Text(`${this.isInformation_mimeType + this.isInformation.mimeType}`).fontColor('#FFFFFF')
Text(`${this.isInformation_mediaType + this.isInformation.mediaType}`).fontColor('#FFFFFF')
Text(`${this.isInformation_displayName + this.isInformation.displayName}`).fontColor('#FFFFFF')
Text(`${this.isInformation_title + this.isInformation.title}`).fontColor('#FFFFFF')
Text(`${this.isInformation_relativePath + this.isInformation.relativePath}`).fontColor('#FFFFFF')
Text(`${this.isInformation_parent + this.isInformation.parent}`).fontColor('#FFFFFF')
Text(`${this.isInformation_size + filterSize(this.isInformation.size)}`).fontColor('#FFFFFF')
Text(`${this.isInformation_dateAdded + getDateTime(this.isInformation.dateAdded)}`).fontColor('#FFFFFF')
Text(`${this.isInformation_dateModified + getDateTime(this.isInformation.dateModified)}`).fontColor('#FFFFFF')
Text(`${this.isInformation_dateTaken + getDateTime(this.isInformation.dateTaken)}`).fontColor('#FFFFFF')
Text(`${this.isInformation_artist + this.isInformation.artist}`).fontColor('#FFFFFF')
Text(`${this.isInformation_audioAlbum + this.isInformation.audioAlbum}`).fontColor('#FFFFFF')
Text(`${this.isInformation_width + this.isInformation.width}`).fontColor('#FFFFFF')
Text(`${this.isInformation_height + this.isInformation.height}`).fontColor('#FFFFFF')
Text(`${this.isInformation_orientation + this.isInformation.orientation}`).fontColor('#FFFFFF')
Text(`${this.isInformation_duration + getTimeString(this.isInformation.duration)}`).fontColor('#FFFFFF')
Text(`${this.isInformation_albumId + this.isInformation.albumId}`).fontColor('#FFFFFF')
Text(`${this.isInformation_albumUri + this.isInformation.albumUri}`).fontColor('#FFFFFF')
Text(`${this.isInformation_albumName + this.isInformation.albumName}`).fontColor('#FFFFFF')
}.width('100%').height('100%')
}
.scrollBar(BarState.Off)
.scrollBarColor(Color.White)
.padding('1%')
.backgroundColor('rgba(0,0,0,0.6)')
.width('22%')
.height('71%')
}
}

View File

@ -1,81 +0,0 @@
/*
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import Logger from '../model/Logger';
const TAG: string = 'MediaUtils';
class MediaUtils {
private mediaList: mediaLibrary.FileAsset[] = [];
public mediaLib: mediaLibrary.MediaLibrary = undefined;
async queryFile(id: string): Promise<mediaLibrary.FileAsset> {
Logger.info(TAG, `queryFile,id = ${id}`);
const fetchOp: mediaLibrary.MediaFetchOptions = {
selections: `${mediaLibrary.FileKey.ID}=?`,
selectionArgs: [id],
};
const fetchFileResult = await this.mediaLib.getFileAssets(fetchOp);
Logger.info(TAG, `fetchFileResult.getCount() = ${fetchFileResult.getCount()}`);
const fileAsset = await fetchFileResult.getAllObject();
return fileAsset[0];
}
async getFdPath(fileAsset: any) {
let fd = await fileAsset.open('Rw');
Logger.info(TAG, `fd = ${fd}`);
return fd;
}
async getFileAssetsFromType(mediaType: number) {
Logger.info(TAG, `getFileAssetsFromType,mediaType = ${mediaType}`);
let fileKeyObj = mediaLibrary.FileKey;
let fetchOp = {
selections: `${fileKeyObj.MEDIA_TYPE}=?`,
selectionArgs: [`${mediaType}`],
};
let fetchFileResult = await this.mediaLib.getFileAssets(fetchOp);
Logger.info(TAG, `getFileAssetsFromType,fetchFileResult.count = ${fetchFileResult.getCount()}`);
if (fetchFileResult.getCount() > 0) {
this.mediaList = await fetchFileResult.getAllObject();
}
return this.mediaList;
}
deleteFile(fileAsset: mediaLibrary.FileAsset): Promise<void> {
Logger.info(TAG, `deleteFile,displayName=${fileAsset.displayName},uri = ${fileAsset.uri}`);
return fileAsset.trash(true);
}
onDateChange(audioCallback: () => void, videoCallback: () => void) {
this.mediaLib.on('audioChange', () => {
Logger.info(TAG, 'videoChange called');
audioCallback();
});
this.mediaLib.on('videoChange', () => {
Logger.info(TAG, 'videoChange called');
videoCallback();
});
}
offDateChange() {
this.mediaLib.off('videoChange');
this.mediaLib.off('audioChange');
}
}
export default new MediaUtils();

View File

@ -28,7 +28,7 @@
6. 返回应用首页选择drm在线播放进入播放列表。
7. 播放列表中都是drm加密片源在列表中选择一条片源点击进入播放页后底层检测到加密片源会自动执行drm解密流程进行在线播放。
8. 在播放页可以进行拖动进度条seek、暂停、倍速、循环、跳转第一帧、跳转最后一帧等操作。
9. 返回播放列表,点击钥匙按钮后再次播放,对应片源会走drm离线license播放使用与在线相同。
9. 返回播放列表,点击第四个可离线视频的钥匙按钮后播放视频片源会走drm离线license播放LicenseType会由Streaming变为offLine,使用与在线相同。
### 工程目录
```
@ -88,7 +88,7 @@ entry/src/main/ets/
* 获取音频模块
* 使用媒体库接口进行音视频的扫描获取音视频详细信息重命名和删除操作使用PixelMap方法读取或写入图像数据以及获取图像信息。
* 源码链接:[myMedia.ts](entry/src/main/ets/model/myMedia.ts)[IsInformationDialog.ets](entry/src/main/ets/common/IsInformationDialog.ets)[DeleteDialog.ets](entry/src/main/ets/common/DeleteDialog.ets)[RenameDialog.ets](entry/src/main/ets/common/RenameDialog.ets)
* 接口参考:[@ohos.multimedia.mediaLibrary](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-media-library-kit/js-apis-medialibrary.md)[@ohos.multimedia.image](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-image-kit/js-apis-image.md)[@ohos.prompt](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-as/js-apis-promptAction.md)
* 接口参考:[@ohos.multimedia.image](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-image-kit/js-apis-image.md)[@ohos.prompt](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-as/js-apis-promptAction.md)
* 音频,视频操作模块
* 使用媒体服务进行音视频播放暂停seek等操作其中AudioPlayer方法播放音频VideoPlayer方法播放视频。
@ -107,9 +107,15 @@ entry/src/main/ets/
### 相关权限
1.读取公共媒体文件权限:[ohos.permission.READ_MEDIA](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/AccessToken/permissions-for-all.md#ohospermissionread_media)
1.读取公共目录的图片或视频文件:[ohos.permission.READ_IMAGEVIDEO](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/AccessToken/permissions-for-system-apps.md#ohospermissionread_imagevideo)
2.读写公共媒体文件权限:[ohos.permission.WRITE_MEDIA](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/AccessToken/permissions-for-all.md#ohospermissionwrite_media)
2.修改公共目录的图片或视频文件:[ohos.permission.WRITE_IMAGEVIDEO](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/AccessToken/permissions-for-system-apps.md#ohospermissionwrite_imagevideo)
3.读取公共目录的音频文件:[ohos.permission.READ_AUDIO](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/AccessToken/permissions-for-system-apps.md#ohospermissionread_audio)
4.修改公共目录的音频文件:[ohos.permission.WRITE_AUDIO](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/AccessToken/permissions-for-system-apps.md#ohospermissionwrite_audio)
5.使用Internet网络[ohos.permission.INTERNET](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/AccessToken/permissions-for-all.md#ohospermissioninternet)
### 依赖

View File

@ -23,6 +23,14 @@ const TAG: string = 'MainAbility';
export default class MainAbility extends UIAbility {
async onCreate(want, launchParam) {
Logger.info(TAG, '[Demo] MainAbility onCreate');
const PERMISSIONS: Array<Permissions> = [
"ohos.permission.READ_AUDIO",
"ohos.permission.WRITE_AUDIO",
"ohos.permission.READ_IMAGEVIDEO",
"ohos.permission.WRITE_IMAGEVIDEO"
];
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
atManager.requestPermissionsFromUser(this.context, PERMISSIONS);
}
onDestroy() {
@ -31,13 +39,6 @@ export default class MainAbility extends UIAbility {
async onWindowStageCreate(windowStage) {
Logger.info(TAG, '[Demo] MainAbility onWindowStageCreate');
let context = this.context;
let permissionNames: Permissions[] = ['ohos.permission.MEDIA_LOCATION', 'ohos.permission.READ_MEDIA',
'ohos.permission.WRITE_MEDIA'];
let atManager = abilityAccessCtrl.createAtManager();
await atManager.requestPermissionsFromUser(context, permissionNames).then((data) => {
Logger.info(TAG, 'getPermission success');
});
windowStage.loadContent('pages/HomePage', (err, data) => {
if (err.code) {
Logger.info(TAG, 'Failed to load the content. Cause:' + JSON.stringify(err));

View File

@ -14,7 +14,7 @@
*/
import audio from '@ohos.multimedia.audio'
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import userFileManager from '@ohos.filemanagement.userFileManager';
import { AVPlayer } from '../model/AVPlayer'
import { getTimeString } from '../model/TimeTools'
import { isInformationDialog } from '../common/IsInformationDialog'
@ -33,12 +33,12 @@ export struct BroadcastControl {
@Link currentTime: number
@Link btnEnabled: boolean
@Link isXComponent: boolean
@Link itemData: mediaLibrary.FileAsset
@Link itemData: userFileManager.FileAsset
@Link @Watch('onChangeIsShowMenu') isShowMenu: boolean
@State isVolume: boolean = false
@State mediaVolumeValue: number = -1
@State isInformation: boolean = false
@State isInformationObj: mediaLibrary.FileAsset = {} as mediaLibrary.FileAsset
@State isInformationObj: userFileManager.FileAsset = {} as userFileManager.FileAsset
@State selectText: string = ''
private timerOut: number = 0
private scroller: Scroller = new Scroller()
@ -168,8 +168,8 @@ export struct BroadcastControl {
.fontColor(Color.White)
.selectedOptionFont({ size: 18 })
.optionFontColor(Color.Black)
.opacity(this.itemData ? (this.itemData.mediaType == mediaLibrary.MediaType.AUDIO ? 0 : 1) : 0.4)
.enabled(this.itemData ? (this.itemData.mediaType == mediaLibrary.MediaType.AUDIO ? false : true) : false)
.opacity(this.itemData ? (this.itemData.fileType == userFileManager.FileType.AUDIO ? 0 : 1) : 0.4)
.enabled(this.itemData ? (this.itemData.fileType == userFileManager.FileType.AUDIO ? false : true) : false)
.optionFont({ size: 18 })
.onSelect((index: number) => {
this.myMedia.setSpeed(index)

View File

@ -14,7 +14,7 @@
*/
import display from '@ohos.display'
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import userFileManager from '@ohos.filemanagement.userFileManager';
import { promptShowToast } from '../model/Prompt'
import MediaUtils from '../model/MediaUtils'
@ -22,18 +22,18 @@ import MediaUtils from '../model/MediaUtils'
export struct DeleteDialog {
@State displayWidth: number = 0
private index: number = 0
private mediaData: mediaLibrary.FileAsset[] = []
private mediaData: userFileManager.FileAsset[] = []
private controller: CustomDialogController = {} as CustomDialogController
private mediaType: mediaLibrary.MediaType = 0
private mediaType: userFileManager.FileType = userFileManager.FileType.AUDIO
async aboutToAppear() {
let abilityDisplay = await display.getDefaultDisplay()
aboutToAppear() {
let abilityDisplay = display.getDefaultDisplaySync()
this.displayWidth = abilityDisplay.width
}
build() {
Column() {
Text(this.mediaType == mediaLibrary.MediaType.AUDIO ? $r('app.string.index_del_audio') : $r('app.string.index_del'))
Text(this.mediaType == userFileManager.FileType.AUDIO ? $r('app.string.index_del_audio') : $r('app.string.index_del'))
.fontSize(18)
.fontColor(this.displayWidth > 2500 ? Color.White : Color.Black)
.margin({ top: 10 })

View File

@ -0,0 +1,73 @@
/*
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import userFileManager from '@ohos.filemanagement.userFileManager';
import { myMedia } from '../model/myMedia'
import { getTimeString } from '../model/TimeTools'
@CustomDialog
export struct isInformationDialog {
@Link myMedia: myMedia
@State isInformation_uri: string = ''
@State isInformation_mediaType: string = ''
@State isInformation_displayName: string = ''
@State isInformation_title: string = ''
@State isInformation_width: string = ''
@State isInformation_height: string = ''
@State isInformation_orientation: string = ''
@State isInformation_duration: string = ''
private controller: CustomDialogController = {} as CustomDialogController
private isInformation: userFileManager.FileAsset = {} as userFileManager.FileAsset
private scroller: Scroller = new Scroller()
private context: Context = getContext(this)
async aboutToAppear() {
this.myMedia.getPause()
this.isInformation = this.myMedia.getResourceAddress()
this.isInformation_uri = await this.convertResourceToString($r('app.string.index_formation_uri'))
this.isInformation_mediaType = await this.convertResourceToString($r('app.string.index_formation_mediaType'))
this.isInformation_displayName = await this.convertResourceToString($r('app.string.index_formation_displayName'))
this.isInformation_title = await this.convertResourceToString($r('app.string.index_formation_title'))
this.isInformation_width = await this.convertResourceToString($r('app.string.index_formation_width'))
this.isInformation_height = await this.convertResourceToString($r('app.string.index_formation_height'))
this.isInformation_orientation = await this.convertResourceToString($r('app.string.index_formation_orientation'))
this.isInformation_duration = await this.convertResourceToString($r('app.string.index_formation_duration'))
}
async convertResourceToString(resource: Resource): Promise<string> {
return await this.context.resourceManager.getStringValue(resource.id)
}
build() {
Scroll(this.scroller) {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceEvenly }) {
Text($r('app.string.index_formation')).fontColor('#FFFFFF')
Text(`${this.isInformation_uri + this.isInformation.uri}`).fontColor('#FFFFFF')
Text(`${this.isInformation_mediaType + this.isInformation.fileType}`).fontColor('#FFFFFF')
Text(`${this.isInformation_displayName + this.isInformation.displayName}`).fontColor('#FFFFFF')
Text(`${this.isInformation_title + this.isInformation.get('title')}`).fontColor('#FFFFFF')
Text(`${this.isInformation_width + this.isInformation.get('width')}`).fontColor('#FFFFFF')
Text(`${this.isInformation_height + this.isInformation.get('height')}`).fontColor('#FFFFFF')
Text(`${this.isInformation_orientation + this.isInformation.get('orientation')}`).fontColor('#FFFFFF')
Text(`${this.isInformation_duration + getTimeString(this.isInformation.get('duration'))}`).fontColor('#FFFFFF')
}.width('100%').height('100%')
}
.scrollBar(BarState.Off)
.scrollBarColor(Color.White)
.padding('1%')
.backgroundColor('rgba(0,0,0,0.6)')
.width('22%')
.height('71%')
}
}

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import iaImage from '@ohos.multimedia.image'
import userFileManager from '@ohos.filemanagement.userFileManager';
import image from '@ohos.multimedia.image';
import { getTimeString } from '../model/TimeTools'
import Logger from '../model/Logger'
@ -28,8 +28,8 @@ export struct MediaItem {
@Link @Watch('leftSliderChange') leftSliderIndex: number
@State translateLeft: number = 0
@State translateRight: number = TRANSLATE
@State pixelMap: iaImage.PixelMap = {} as iaImage.PixelMap
@State mediaItem: mediaLibrary.FileAsset = {} as mediaLibrary.FileAsset
@State pixelMap: image.PixelMap = {} as image.PixelMap
@State mediaItem: userFileManager.FileAsset = {} as userFileManager.FileAsset
private index: number = -1
private deleteDialogShow: () => void = () => {
}
@ -54,8 +54,8 @@ export struct MediaItem {
}
async aboutToAppear() {
let size: mediaLibrary.Size = { width: 100, height: 66 }
this.mediaItem.getThumbnail(size, (err: Error, pixelMap: iaImage.PixelMap) => {
let size: image.Size = { width: 100, height: 66 }
this.mediaItem.getThumbnail(size, (err: Error, pixelMap: image.PixelMap) => {
Logger.info(TAG, 'getThumbnail callback')
if (err) {
Logger.info(TAG, `getThumbnail callback,err=${JSON.stringify(err)}`)
@ -66,8 +66,8 @@ export struct MediaItem {
})
}
getImageSrc() {
if (this.mediaItem.mediaType === mediaLibrary.MediaType.VIDEO) {
getImageSrc(): Resource {
if (this.mediaItem.fileType == userFileManager.FileType.VIDEO) {
return $r('app.media.videoCover')
} else {
return $r('app.media.audioCover')
@ -87,7 +87,7 @@ export struct MediaItem {
.borderRadius(12)
.objectFit(ImageFit.Fill)
Text(getTimeString(this.mediaItem.duration))
Text(getTimeString(this.mediaItem.get('duration') as number))
.fontSize(14)
.fontColor('#FFFFFF')
.position({
@ -137,7 +137,7 @@ export struct MediaItem {
.onClick(() => {
this.leftSliderIndex = -1
this.fileIndex = this.index
this.fileType = this.mediaItem.mediaType
this.fileType = this.mediaItem.fileType
this.renameDialogShow()
})
@ -161,7 +161,7 @@ export struct MediaItem {
})
.onClick(() => {
this.fileIndex = this.index
this.fileType = this.mediaItem.mediaType
this.fileType = this.mediaItem.fileType
this.deleteDialogShow()
this.leftSliderIndex = -1
})

View File

@ -14,7 +14,7 @@
*/
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import userFileManager from '@ohos.filemanagement.userFileManager';
import { gridData } from '../model/GridData'
import { AVPlayer } from '../model/AVPlayer'
import { MediaItem } from './MediaItem'
@ -33,9 +33,9 @@ export struct Toolkit {
@Link isXComponent: boolean
@Link isStreamShow: boolean
@Link streamBtnText: Resource
@Link itemData: mediaLibrary.FileAsset
@Link audioData: mediaLibrary.FileAsset[]
@Link videoData: mediaLibrary.FileAsset[]
@Link itemData: userFileManager.FileAsset
@Link audioData: userFileManager.FileAsset[]
@Link videoData: userFileManager.FileAsset[]
@Link fileIndex: number
@Link fileType: number
@State isBom: boolean = true
@ -123,7 +123,7 @@ export struct Toolkit {
if (this.isTitle == this.audioText) {
Column() {
List({ initialIndex: 0 }) {
ForEach(this.audioData, (item: mediaLibrary.FileAsset, index) => {
ForEach(this.audioData, (item: userFileManager.FileAsset, index) => {
ListItem() {
MediaItem({
index: index,
@ -154,7 +154,7 @@ export struct Toolkit {
}, 1000)
}
})
}, (item: mediaLibrary.FileAsset) => item.id.toString())
}, (item: userFileManager.FileAsset) => item.uri)
}
.editMode(true)
}
@ -163,7 +163,7 @@ export struct Toolkit {
if (this.isTitle == this.videoText) {
Column() {
List({ initialIndex: 0 }) {
ForEach(this.videoData, (item: mediaLibrary.FileAsset, index) => {
ForEach(this.videoData, (item: userFileManager.FileAsset, index) => {
ListItem() {
MediaItem({
index: index,
@ -198,7 +198,7 @@ export struct Toolkit {
}, 1000)
}
})
}, (item: mediaLibrary.FileAsset) => item.id.toString())
}, (item: userFileManager.FileAsset) => item.uri)
}
.editMode(true)
}

View File

@ -1,26 +1,26 @@
/*
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export class MediaUtiles {
private newName: string = '';
setName(newName: string): void {
this.newName = newName;
}
getName(): string {
return this.newName;
}
/*
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export class MediaUtiles {
private newName: string = '';
setName(newName: string): void {
this.newName = newName;
}
getName(): string {
return this.newName;
}
}

View File

@ -0,0 +1,84 @@
/*
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import dataSharePredicates from '@ohos.data.dataSharePredicates';
import userFileManager from '@ohos.filemanagement.userFileManager';
import Logger from '../model/Logger';
const TAG: string = 'MediaUtils';
class MediaUtils {
private mediaList: userFileManager.FileAsset[] = [];
public mediaLib: userFileManager.UserFileManager = undefined;
async getFileAssetsFromType(mediaType: number) {
Logger.info(TAG, `getFileAssetsFromType,mediaType = ${mediaType}`);
let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
// 过滤图片资源、且保证音视频时长均大于0
predicates.greaterThan("duration", 0)
let fetchOptions: userFileManager.FetchOptions = {
fetchColumns: ['duration'],
predicates: predicates
};
try {
let fetchResult: userFileManager.FetchResult<userFileManager.FileAsset> = undefined
if (mediaType === userFileManager.FileType.AUDIO) {
// 获取音频资源
fetchResult = await this.mediaLib.getAudioAssets(fetchOptions);
} else if (mediaType === userFileManager.FileType.VIDEO) {
fetchOptions.fetchColumns = [
'title',
'duration',
'width',
'height',
'orientation'
];
// 获取视频资源
fetchResult = await this.mediaLib.getPhotoAssets(fetchOptions);
}
Logger.info(TAG, `mediaType = ${mediaType} getFileAssetsFromType,fetchResult.count = ${fetchResult.getCount()}`);
if (fetchResult != undefined) {
Logger.info(TAG,'fetchResult success');
this.mediaList = await fetchResult.getAllObject();
}
} catch (err) {
Logger.info(TAG,'getMediaAssets failed, message = ', err);
}
return this.mediaList;
}
deleteFile(fileAsset: userFileManager.FileAsset): Promise<void> {
Logger.info(TAG, `deleteFile,displayName=${fileAsset.displayName},uri = ${fileAsset.uri}`);
return this.mediaLib.delete(fileAsset.uri);
}
onDateChange(audioCallback: () => void, videoCallback: () => void) {
this.mediaLib.on('audioChange', () => {
Logger.info(TAG, 'videoChange called');
audioCallback();
});
this.mediaLib.on('videoChange', () => {
Logger.info(TAG, 'videoChange called');
videoCallback();
});
}
offDateChange() {
this.mediaLib.off('videoChange');
this.mediaLib.off('audioChange');
}
}
export default new MediaUtils();

View File

@ -13,15 +13,14 @@
* limitations under the License.
*/
// @ts-nocheck
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import userFileManager from '@ohos.filemanagement.userFileManager';
import media from '@ohos.multimedia.media';
import Logger from '../model/Logger';
const TAG = 'myMedia:';
export class myMedia {
public resourceAddress: mediaLibrary.FileAsset = undefined;
public resourceAddress: userFileManager.FileAsset = undefined;
public fileName: string = undefined;
public totalDuration: number = 0;
public format: string;
@ -29,11 +28,11 @@ export class myMedia {
private playStatus: string;
private playMode: string;
private currentNode: string;
private media: media.AudioPlayer | media.VideoPlayer;
private media: media.AVPlayer;
private surfaceId: string = '';
private isLoop: boolean;
private audioData: mediaLibrary.FileAsset[];
private videoData: mediaLibrary.FileAsset[];
private audioData: userFileManager.FileAsset[];
private videoData: userFileManager.FileAsset[];
private fileIndex: number = 0;
private mediaDataLen: number;
private uri: string = undefined;
@ -52,10 +51,10 @@ export class myMedia {
} else {
this.fileIndex = this.mediaDataLen - 1;
}
if (this.resourceAddress.mediaType == mediaLibrary.MediaType.AUDIO) {
if (this.resourceAddress.fileType == userFileManager.FileType.AUDIO) {
this.resourceAddress = this.audioData[this.fileIndex];
this.init(this.resourceAddress);
} else if (this.resourceAddress.mediaType == mediaLibrary.MediaType.VIDEO) {
} else if (this.resourceAddress.fileType == userFileManager.FileType.VIDEO) {
this.resourceAddress = this.videoData[this.fileIndex];
this.init(this.resourceAddress, surfaceId);
}
@ -67,10 +66,10 @@ export class myMedia {
} else {
this.fileIndex = 0;
}
if (this.resourceAddress.mediaType == mediaLibrary.MediaType.AUDIO) {
if (this.resourceAddress.fileType == userFileManager.FileType.AUDIO) {
this.resourceAddress = this.audioData[this.fileIndex];
this.init(this.resourceAddress);
} else if (this.resourceAddress.mediaType == mediaLibrary.MediaType.VIDEO) {
} else if (this.resourceAddress.fileType == userFileManager.FileType.VIDEO) {
this.resourceAddress = this.videoData[this.fileIndex];
this.init(this.resourceAddress, surfaceId);
}
@ -78,7 +77,7 @@ export class myMedia {
getFileIndex(data) {
data.forEach((file, index) => {
if (file.id === this.resourceAddress.id) {
if (file.uri === this.resourceAddress.uri) {
this.fileIndex = index;
}
});
@ -96,21 +95,18 @@ export class myMedia {
}
this.stop();
this.release();
this.media = await media.createVideoPlayer();
this.media = await media.createAVPlayer();
this.setVideoCallBack(this.media);
this.media.url = url;
await this.media.setDisplaySurface(this.surfaceId).then(() => {
Logger.info(TAG, 'httpInit success');
}).catch((error) => {
Logger.info(TAG, `httpInit setDisplaySurface fali error:${error.message}`);
});
this.media.surfaceId = this.surfaceId;
Logger.info(TAG, 'httpInit success');
await this.media.prepare();
this.totalDuration = this.media.duration;
this.fileName = 'Http';
this.media.play();
}
async init(resourceAddress: mediaLibrary.FileAsset, surfaceId?) {
async init(resourceAddress: userFileManager.FileAsset, surfaceId?) {
Logger.info(TAG, 'init state');
if (surfaceId) {
this.surfaceId = surfaceId.toString();
@ -122,26 +118,24 @@ export class myMedia {
Logger.info(TAG, `resourceAddress success: ${this.resourceAddress}`);
this.fileName = resourceAddress.displayName;
Logger.info(TAG, `fileName success: ${this.fileName}`);
this.totalDuration = resourceAddress.duration;
this.totalDuration = resourceAddress.get('duration') as number;
Logger.info(TAG, `totalDuration success: ${this.totalDuration}`);
this.resourceAddress.open('r').then(async (fd) => {
Logger.info(TAG, `fd success: ${fd}`);
if (this.resourceAddress.mediaType == mediaLibrary.MediaType.AUDIO) {
this.media = await media.createAVPlayer();
this.media.url = 'fd://' + fd;
if (this.resourceAddress.fileType == userFileManager.FileType.AUDIO) {
Logger.info(TAG, 'AUDIO success');
this.getFileIndex(this.audioData);
this.mediaDataLen = this.audioData.length;
this.media = media.createAudioPlayer();
Logger.info(TAG, `AUDIO success: ${this.media}`);
this.setAudioCallBack(this.media);
this.media.src = 'fd://' + fd;
} else if (this.resourceAddress.mediaType == mediaLibrary.MediaType.VIDEO) {
} else if (this.resourceAddress.fileType == userFileManager.FileType.VIDEO) {
Logger.info(TAG, 'VIDEO success');
this.getFileIndex(this.videoData);
this.mediaDataLen = this.videoData.length;
this.media = await media.createVideoPlayer();
this.setVideoCallBack(this.media);
this.media.url = 'fd://' + fd;
await this.media.setDisplaySurface(this.surfaceId);
this.media.surfaceId = this.surfaceId;
await this.media.prepare();
Logger.info(TAG, 'VIDEO end');
}
@ -167,7 +161,7 @@ export class myMedia {
audioPlayer.on('finish', () => {
Logger.info(TAG, 'AUDIO case finish called');
this.release();
if (this.resourceAddress && this.resourceAddress.mediaType) {
if (this.resourceAddress && this.resourceAddress.fileType) {
this.next();
}
});
@ -197,7 +191,7 @@ export class myMedia {
videoPlayer.on('playbackCompleted', () => {
Logger.info(TAG, 'VIDEO playbackCompleted finish');
this.release();
if (this.resourceAddress && this.resourceAddress.mediaType) {
if (this.resourceAddress && this.resourceAddress.fileType) {
this.next();
}
});
@ -260,13 +254,8 @@ export class myMedia {
setSpeed(speed) {
if (typeof (this.media) != 'undefined') {
this.media.setSpeed(speed, (err) => {
if (typeof (err) == 'undefined') {
Logger.info(TAG, 'setSpeed success');
} else {
Logger.info(TAG, 'setSpeed fail!!');
}
});
this.media.setSpeed(speed);
Logger.info(TAG, 'setSpeed success');
}
}
@ -275,8 +264,4 @@ export class myMedia {
await this.media.seek(time);
}
}
getFormat() {
return this.resourceAddress.mimeType;
}
}

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import userFileManager from '@ohos.filemanagement.userFileManager';
import Logger from '../model/Logger'
import { AVPlayer } from '../model/AVPlayer'
import MediaUtils from '../model/MediaUtils'
@ -47,10 +47,10 @@ struct Index {
@State streamBtnText: Resource = $r('app.string.index_play')
@State streamOpacity: number = 0.4
@State fileIndex: number = 0
@State fileType: number = 0
@State itemDate: mediaLibrary.FileAsset = {} as mediaLibrary.FileAsset
@State audioData: mediaLibrary.FileAsset[] = []
@State videoData: mediaLibrary.FileAsset[] = []
@State fileType: number = userFileManager.FileType.AUDIO
@State itemDate: userFileManager.FileAsset = {} as userFileManager.FileAsset
@State audioData: userFileManager.FileAsset[] = []
@State videoData: userFileManager.FileAsset[] = []
@State @Watch('onChangeLoop') isLoop: boolean = false
@State @Watch('onChangePlay') isPlaying: boolean = false
@State streamBackgroundColor: string = '#99B9F8'
@ -67,7 +67,7 @@ struct Index {
private context: Context = getContext(this)
async aboutToAppear() {
MediaUtils.mediaLib = mediaLibrary.getMediaLibrary(this.context)
MediaUtils.mediaLib = userFileManager.getUserFileMgr(this.context)
await this.getAudioData()
await this.getVideoData()
this.mainDialogController.open()
@ -78,7 +78,7 @@ struct Index {
}
async convertResourceToString(resource: Resource) {
return await this.context.resourceManager.getString(resource.id)
return await this.context.resourceManager.getStringValue(resource.id)
}
onPageShow() {
@ -91,11 +91,11 @@ struct Index {
async getAudioData() {
this.audioData = []
let fileAsset = MediaUtils.getFileAssetsFromType(mediaLibrary.MediaType.AUDIO)
let fileAsset = MediaUtils.getFileAssetsFromType(userFileManager.FileType.AUDIO)
fileAsset.then(fileList => {
Logger.info(TAG, 'getFileList callback')
this.audioData = fileList
this.myMedia.getAudioData(this.audioData)
this.myMedia.setAudioData(this.audioData)
}).catch((err: Error) => {
Logger.error(TAG, `getFileList err,err = ${err}`)
})
@ -103,11 +103,11 @@ struct Index {
async getVideoData() {
this.videoData = []
let fileAsset = MediaUtils.getFileAssetsFromType(mediaLibrary.MediaType.VIDEO)
let fileAsset = MediaUtils.getFileAssetsFromType(userFileManager.FileType.VIDEO)
fileAsset.then(fileList => {
Logger.info(TAG, 'getFileList callback')
this.videoData = fileList
this.myMedia.getVideoData(this.videoData)
this.myMedia.setVideoData(this.videoData)
}).catch((err: Error) => {
Logger.error(TAG, `getFileList err,err = ${err}`)
})
@ -127,7 +127,7 @@ struct Index {
this.fillMediaType = this.fileType
let disPlayName: string = ''
let disPlayType: string = ''
if (this.fileType == mediaLibrary.MediaType.AUDIO) {
if (this.fileType == userFileManager.FileType.AUDIO) {
disPlayName = this.audioData[this.fillIndex].displayName
let audio: string = await this.convertResourceToString($r('app.string.phoneMain_audioTitle'))
disPlayType = audio
@ -151,7 +151,7 @@ struct Index {
setRename(): void {
this.newName = this.testUtile.getName()
if (this.fillMediaType == mediaLibrary.MediaType.AUDIO) {
if (this.fillMediaType == userFileManager.FileType.AUDIO) {
this.audioData[this.fileIndex].displayName = this.newName
this.audioData[this.fileIndex].commitModify((err) => {
if (err !== undefined) {
@ -177,8 +177,8 @@ struct Index {
}
deleteDialogShow(): void {
let mediaData: mediaLibrary.FileAsset[] = []
if (this.fileType == mediaLibrary.MediaType.AUDIO) {
let mediaData: userFileManager.FileAsset[] = []
if (this.fileType == userFileManager.FileType.AUDIO) {
mediaData = this.audioData
} else {
mediaData = this.videoData

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import userFileManager from '@ohos.filemanagement.userFileManager';
import common from '@ohos.app.ability.common'
import Logger from '../model/Logger'
import { AVPlayer } from '../model/AVPlayer'
@ -33,8 +33,8 @@ const TAG = 'PhoneIndex: '
struct Send {
@State surfaceId: number = -1
@State myMedia: AVPlayer = new AVPlayer()
@State audioData: mediaLibrary.FileAsset[] = []
@State videoData: mediaLibrary.FileAsset[] = []
@State audioData: userFileManager.FileAsset[] = []
@State videoData: userFileManager.FileAsset[] = []
@State fillIndex: number = -1
@State fillMediaType: number = -1
@State currentTime: number = 0
@ -43,7 +43,7 @@ struct Send {
@State isXComponent: boolean = true
@State httpUrl: string = ''
@State fileIndex: number = 0
@State fileType: number = 0
@State fileType: number = userFileManager.FileType.AUDIO
@State newName: string = ''
private testUtile: MediaUtiles = new MediaUtiles()
private renameDialogController: CustomDialogController = {} as CustomDialogController
@ -52,7 +52,7 @@ struct Send {
private context: Context = getContext(this) as common.UIAbilityContext
async aboutToAppear() {
MediaUtils.mediaLib = mediaLibrary.getMediaLibrary(this.context)
MediaUtils.mediaLib = userFileManager.getUserFileMgr(this.context)
await this.getAudioData()
await this.getVideoData()
this.myMedia.setCompleteCallback(() => {
@ -67,11 +67,11 @@ struct Send {
async getAudioData() {
this.audioData = []
let fileAsset = MediaUtils.getFileAssetsFromType(mediaLibrary.MediaType.AUDIO)
fileAsset.then((fileList: mediaLibrary.FileAsset[]) => {
let fileAsset = MediaUtils.getFileAssetsFromType(userFileManager.FileType.AUDIO)
fileAsset.then((fileList: userFileManager.FileAsset[]) => {
Logger.info(TAG, 'getFileList callback')
this.audioData = fileList
this.myMedia.getAudioData(this.audioData)
this.myMedia.setAudioData(this.audioData)
}).catch((err: Error) => {
Logger.error(TAG, `getFileList err,err = ${err}`)
})
@ -79,11 +79,11 @@ struct Send {
async getVideoData() {
this.videoData = []
let fileAsset = MediaUtils.getFileAssetsFromType(mediaLibrary.MediaType.VIDEO)
fileAsset.then((fileList: mediaLibrary.FileAsset[]) => {
let fileAsset = MediaUtils.getFileAssetsFromType(userFileManager.FileType.VIDEO)
fileAsset.then((fileList: userFileManager.FileAsset[]) => {
Logger.info(TAG, 'getFileList callback')
this.videoData = fileList
this.myMedia.getVideoData(this.videoData)
this.myMedia.setVideoData(this.videoData)
}).catch((err: Error) => {
Logger.error(TAG, `getFileList err,err = ${err}`)
})
@ -98,7 +98,7 @@ struct Send {
}
async convertResourceToString(resource: Resource): Promise<string> {
return this.context.resourceManager.getString(resource.id)
return this.context.resourceManager.getStringValue(resource.id)
}
async renameDialogShow(): Promise<void> {
@ -106,7 +106,7 @@ struct Send {
this.fillMediaType = this.fileType
let disPlayName: string
let disPlayType: string
if (this.fileType == mediaLibrary.MediaType.AUDIO) {
if (this.fileType == userFileManager.FileType.AUDIO) {
disPlayName = this.audioData[this.fileIndex].displayName
let audio = await this.convertResourceToString($r('app.string.phoneMain_audioTitle'))
disPlayType = audio
@ -130,7 +130,7 @@ struct Send {
setRename(): void {
this.newName = this.testUtile.getName()
if (this.fillMediaType == mediaLibrary.MediaType.AUDIO) {
if (this.fillMediaType == userFileManager.FileType.AUDIO) {
this.audioData[this.fileIndex].displayName = this.newName
this.audioData[this.fileIndex].commitModify((err) => {
if (err !== undefined) {
@ -156,8 +156,8 @@ struct Send {
}
deleteDialogShow(): void {
let mediaData: mediaLibrary.FileAsset[]
if (this.fileType == mediaLibrary.MediaType.AUDIO) {
let mediaData: userFileManager.FileAsset[]
if (this.fileType == userFileManager.FileType.AUDIO) {
mediaData = this.audioData
} else {
mediaData = this.videoData

View File

@ -16,7 +16,7 @@
import { MediaItem } from '../common/MediaItem'
import { AVPlayer } from '../model/AVPlayer'
import { gridData } from '../model/GridData'
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import userFileManager from '@ohos.filemanagement.userFileManager';
import { GridDataItem } from '../phoneView/GridDataItem'
@Component
@ -25,14 +25,14 @@ export struct Toolkit {
@State isTitle: string = ''
@State leftSliderIndex: number = -1
@State clickIndex: number = -1
@State itemData: mediaLibrary.FileAsset = {} as mediaLibrary.FileAsset
@State itemData: userFileManager.FileAsset = {} as userFileManager.FileAsset
@State audioText: string = ''
@State videoText: string = ''
@Link myMedia: AVPlayer
@Link currentTime: number
@Link isXComponent: boolean
@Link audioData: mediaLibrary.FileAsset[]
@Link videoData: mediaLibrary.FileAsset[]
@Link audioData: userFileManager.FileAsset[]
@Link videoData: userFileManager.FileAsset[]
@Link isPlaying: boolean
@Link surfaceId: number
@Link fileIndex: number
@ -80,7 +80,7 @@ export struct Toolkit {
Scroll(this.scroller) {
Column() {
List({ initialIndex: 0 }) {
ForEach(this.isTitle == this.audioText ? this.audioData : this.videoData, (item: mediaLibrary.FileAsset, index) => {
ForEach(this.isTitle == this.audioText ? this.audioData : this.videoData, (item: userFileManager.FileAsset, index) => {
ListItem() {
MediaItem({
index: index,
@ -109,7 +109,7 @@ export struct Toolkit {
}, 1000)
}
})
}, (item: mediaLibrary.FileAsset) => item.displayName)
}, (item: userFileManager.FileAsset) => item.displayName)
}
.height(260)
.alignListItem(ListItemAlign.Center)

View File

@ -50,27 +50,54 @@
],
"requestPermissions": [
{
"name": "ohos.permission.WRITE_MEDIA",
"name": "ohos.permission.READ_IMAGEVIDEO",
"reason": "$string:reason",
"usedScene": {
"abilities":[
"MainAbility"
],
"when": "inuse",
"when": "always",
}
},
{
"name": "ohos.permission.READ_MEDIA",
"name": "ohos.permission.WRITE_IMAGEVIDEO",
"reason": "$string:reason",
"usedScene": {
"abilities":[
"MainAbility"
],
"when": "inuse",
"when": "always",
}
},
{
"name": "ohos.permission.INTERNET"
"name": "ohos.permission.READ_AUDIO",
"reason": "$string:reason",
"usedScene": {
"abilities":[
"MainAbility"
],
"when": "always",
}
},
{
"name": "ohos.permission.WRITE_AUDIO",
"reason": "$string:reason",
"usedScene": {
"abilities":[
"MainAbility"
],
"when": "always",
}
},
{
"name": "ohos.permission.INTERNET",
"reason": "$string:reason",
"usedScene": {
"abilities":[
"MainAbility"
],
"when": "always",
}
}
]
}

Some files were not shown because too many files have changed in this diff Show More