zhenghy

音频文件编译报错

import media from '@ohos.multimedia.media';
import {Song} from '../viewModel/Song'
import {AVPlayer} from '../../components/AVPlayer'
import { Song } from '../viewModel/Song'
import { AVPlayer } from '../../components/AVPlayer'
@Entry
@Component
struct AudioDetail {
@State message: string = '大自然的奇迹展览在中国国家博物馆拉开帷幕';
@State iocClock: string = '定时';
@State iconTheOriginal: string = '原文';
@State iconList: string = '列表';
@State text:string=''
@State showList:boolean = false
controller:TextInputController = new TextInputController()
@State text: string = ''
@State showList: boolean = false
controller: TextInputController = new TextInputController()
// 音频
@State songs:Song[]=[]
private avPlayer:media.AVPlayer
@State songs: Song[] = []
// private avPlayer:media.AVPlayer
async aboutToAppear(){
async aboutToAppear() {
//加载音乐列表
// let response = await axios({
// method:'get',
... ... @@ -30,6 +29,7 @@ struct AudioDetail {
// this.setAVPlayerCallback()
// // this.avPlayer.url =
}
// 注册avplayer回调函数
// setAVPlayerCallback() {
// // seek操作结果回调函数
... ... @@ -84,8 +84,8 @@ struct AudioDetail {
// }
build() {
Column(){
Row(){
Column() {
Row() {
Column() {
// 封面
Row() {
... ... @@ -97,6 +97,7 @@ struct AudioDetail {
.justifyContent(FlexAlign.Center)
.width('100%')
.margin({ top: 64 })
// 标题
Row() {
Text(this.message)
... ... @@ -109,6 +110,7 @@ struct AudioDetail {
}
.padding({ left: 34, right: 34 })
.margin({ top: 32 })
// 操作矩阵
Row() {
// 定时
... ... @@ -122,6 +124,7 @@ struct AudioDetail {
.lineHeight(16)
.margin(2)
}
// 原文
Column() {
Image($r('app.media.theOriginal'))
... ... @@ -133,6 +136,7 @@ struct AudioDetail {
.lineHeight(16)
.margin(2)
}
// 列表
Column() {
Image($r('app.media.list'))
... ... @@ -144,27 +148,28 @@ struct AudioDetail {
.lineHeight(16)
.margin(2)
}
.onClick(()=>{
.onClick(() => {
this.showList = !this.showList
console.log('列表',this.showList)
console.log('列表', this.showList)
})
}
.width('100%')
.padding({ left: 49, right: 49 })
.justifyContent(FlexAlign.SpaceBetween)
.margin({ top: 60 })
AVPlayer()
}
}
.height('100%-56')
Row(){
Row() {
Image($r('app.media.leftArrow'))
.width(24)
.height(24)
TextInput({text:this.text,placeholder:'input your word...',controller:this.controller})
TextInput({ text: this.text, placeholder: 'input your word...', controller: this.controller })
.placeholderColor('#999999')
.placeholderFont({size:12,weight:400})
.placeholderFont({ size: 12, weight: 400 })
.caretColor(Color.White)
.height(30)
.width(115)
... ... @@ -173,14 +178,14 @@ struct AudioDetail {
.backgroundColor('rgba(255,255,255,0.1)')
.borderRadius(0)
.backgroundColor('[UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1.0].CGColor')
.onChange((value:string)=>{
.onChange((value: string) => {
this.text = value
})
// 消息
Badge({
count:100,
style:{fontSize:12,badgeColor:'#FA2A2D'},
}){
count: 100,
style: { fontSize: 12, badgeColor: '#FA2A2D' },
}) {
Image($r('app.media.news'))
.width(24)
.height(24)
... ... @@ -188,9 +193,9 @@ struct AudioDetail {
// 点赞
Badge({
count:100,
style:{fontSize:12,badgeColor:'#FA2A2D'},
}){
count: 100,
style: { fontSize: 12, badgeColor: '#FA2A2D' },
}) {
Image($r('app.media.like'))
.width(24)
.height(24)
... ...