|
|
@@ -80,7 +80,7 @@ import { IndexerView } from './IndexerView';
|
|
|
import { KeyCode } from '@kit.InputKit';
|
|
|
import { KnockController } from '../controller/KnockController';
|
|
|
import { DeleteComptent } from '../view/DeleteComptent'
|
|
|
-// import { FFmpeg, FFProgressMessageParser } from '@sj/ffmpeg';
|
|
|
+import { ABLoopComptent } from '../view/ABLoopComptent';
|
|
|
const TAG = 'LocalMusic';
|
|
|
|
|
|
const DEFAULT_INDEX =
|
|
|
@@ -2028,6 +2028,15 @@ export struct LocalMusic {
|
|
|
.visibility(Visibility.Hidden)
|
|
|
.height(CommonConstants.FULL_PERCENT)
|
|
|
.width(CommonConstants.FULL_PERCENT)
|
|
|
+ .bindSheet($$this.isABSheet, this.ABLoopSheet(), {
|
|
|
+ height:this.isLandscape?'80%': '43%',
|
|
|
+ dragBar: true,
|
|
|
+ showClose: true,
|
|
|
+ preferType: this.currentBreakpoint !== BreakpointTypeEnum.SM ? SheetType.CENTER : SheetType.BOTTOM,
|
|
|
+ blurStyle:BlurStyle.Thin,
|
|
|
+ backgroundColor:Color.Transparent,
|
|
|
+ title: { title: 'AB循环' }
|
|
|
+ })
|
|
|
|
|
|
Stack() {
|
|
|
Row() {
|
|
|
@@ -10254,6 +10263,8 @@ export struct LocalMusic {
|
|
|
|
|
|
{ id: 11, image: $r('app.media.time_close'), title: '跳过头尾' },
|
|
|
|
|
|
+ { id:20,image: $r("app.media.a_b"), title: 'AB循环' },
|
|
|
+
|
|
|
{ id: 12, image: $r('app.media.toubo'), title: '投播' },
|
|
|
|
|
|
{ id: 3, image: $r('app.media.hua_zhong_hua'), title: '详情' },
|
|
|
@@ -10352,10 +10363,63 @@ export struct LocalMusic {
|
|
|
}
|
|
|
this.isShowMoreView = false
|
|
|
break;
|
|
|
+ case 20://AB循环
|
|
|
+ this.isABSheet = !this.isABSheet;
|
|
|
+ this.isShowMoreView = false
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ //AB循环
|
|
|
+ @State isOpenAB:boolean = false
|
|
|
+ @State jumpATime:number = 0
|
|
|
+ @State jumpBTime:number = 0
|
|
|
+ @State isABSheet:boolean = false
|
|
|
+
|
|
|
+ @Builder
|
|
|
+ ABLoopSheet() {
|
|
|
+
|
|
|
+ ABLoopComptent({
|
|
|
+ jumpATime:this.jumpATime,
|
|
|
+ jumpBTime:this.jumpBTime,
|
|
|
+ onClickAItem: async ()=>{
|
|
|
+ if(this.mIjkMediaPlayer){
|
|
|
+ this.jumpATime = await this.mIjkMediaPlayer.getCurrentPosition()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onClickBItem: async ()=>{
|
|
|
+ if(this.mIjkMediaPlayer){
|
|
|
+ this.jumpBTime = await this.mIjkMediaPlayer.getCurrentPosition()
|
|
|
+ if(this.jumpBTime<=this.jumpATime){
|
|
|
+ ToastUtil.showToast('设置B点时间不能小于A点时间')
|
|
|
+ this.jumpBTime = 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onCancleButtonClick: async ()=>{
|
|
|
+ this.isOpenAB = false
|
|
|
+ this.isABSheet = false
|
|
|
+ },
|
|
|
+ onStartButtonClick: async ()=>{
|
|
|
+ this.isABSheet = false
|
|
|
+ this.startABLoop()
|
|
|
+ },
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //开始AB循环
|
|
|
+ startABLoop(){
|
|
|
+ if(this.mIjkMediaPlayer){
|
|
|
+ this.seekTo(this.jumpATime+'')
|
|
|
+ this.isOpenAB = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 切换横竖屏
|
|
|
*
|
|
|
@@ -10903,6 +10967,14 @@ export struct LocalMusic {
|
|
|
this.randomColor =
|
|
|
`rgb(${Math.floor(Math.random() * 256)},${Math.floor(Math.random() * 256)},${Math.floor(Math.random() * 256)})`
|
|
|
|
|
|
+ //如果是开启AB循环
|
|
|
+ if(this.isOpenAB){
|
|
|
+ if(position >=this.jumpBTime){
|
|
|
+ this.seekTo(this.jumpATime+'')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 判断是否播放到结束时间
|
|
|
if (this.isOpenJump && duration > this.jumpEndTime * 1000) {
|
|
|
if (position >= duration - this.jumpEndTime * 1000) {
|
|
|
@@ -10965,6 +11037,7 @@ export struct LocalMusic {
|
|
|
private async play(url: string) {
|
|
|
let that = this;
|
|
|
that.showLoadIng();
|
|
|
+ this.isOpenAB = false
|
|
|
//设置XComponent回调的context
|
|
|
if (!!this.mContext) {
|
|
|
this.mIjkMediaPlayer.setContext(this.mContext, 'xcomponentId');
|