|
@@ -55,7 +55,6 @@ import { PlayStatus } from '../common/PlayStatus';
|
|
|
import fs from '@ohos.file.fs';
|
|
import fs from '@ohos.file.fs';
|
|
|
import { image } from '@kit.ImageKit';
|
|
import { image } from '@kit.ImageKit';
|
|
|
import { AVCastPicker, AVCastPickerState, AVCastPickerStyle, avSession } from '@kit.AVSessionKit';
|
|
import { AVCastPicker, AVCastPickerState, AVCastPickerStyle, avSession } from '@kit.AVSessionKit';
|
|
|
-import * as chardet from '@changwei/chardet';
|
|
|
|
|
import { UniversalDetector } from '@ohos/juniversalchardet';
|
|
import { UniversalDetector } from '@ohos/juniversalchardet';
|
|
|
import { SettingPage } from '../pages/SettingPage';
|
|
import { SettingPage } from '../pages/SettingPage';
|
|
|
import { secondToTime } from '../common/util/CommUtils';
|
|
import { secondToTime } from '../common/util/CommUtils';
|
|
@@ -2596,6 +2595,7 @@ export struct LocalMusic {
|
|
|
$r('app.color.text_color'))
|
|
$r('app.color.text_color'))
|
|
|
.fontWeight(500)
|
|
.fontWeight(500)
|
|
|
.borderRadius(12)
|
|
.borderRadius(12)
|
|
|
|
|
+ .visibility(StrUtil.isEmpty(item.md5Str)?Visibility.None:Visibility.Visible)
|
|
|
.margin({ left: this.twoFingerType == 3 ? 6 : 8 })
|
|
.margin({ left: this.twoFingerType == 3 ? 6 : 8 })
|
|
|
.backgroundColor('#FFC107')
|
|
.backgroundColor('#FFC107')
|
|
|
}
|
|
}
|
|
@@ -3618,7 +3618,7 @@ export struct LocalMusic {
|
|
|
Image(StrUtil.isEmpty(item.pixelMapPath) ? Utility.getMusisBg2(index) : item.pixelMapPath)
|
|
Image(StrUtil.isEmpty(item.pixelMapPath) ? Utility.getMusisBg2(index) : item.pixelMapPath)
|
|
|
.height(this.getGridHeight())
|
|
.height(this.getGridHeight())
|
|
|
.width(this.getGridWight())
|
|
.width(this.getGridWight())
|
|
|
- .alt($r('app.media.ic_avatar6'))
|
|
|
|
|
|
|
+ .alt($r('app.media.ic_avatar2'))
|
|
|
.clip(true)
|
|
.clip(true)
|
|
|
.borderRadius({
|
|
.borderRadius({
|
|
|
topLeft: 12,
|
|
topLeft: 12,
|
|
@@ -3674,16 +3674,16 @@ export struct LocalMusic {
|
|
|
.borderRadius(12)
|
|
.borderRadius(12)
|
|
|
.margin({ left: this.twoFingerType == 3 ? 6 : 8 })
|
|
.margin({ left: this.twoFingerType == 3 ? 6 : 8 })
|
|
|
.backgroundColor('#FFC107')
|
|
.backgroundColor('#FFC107')
|
|
|
|
|
+ .visibility(StrUtil.isEmpty(item.md5Str)?Visibility.None:Visibility.Visible)
|
|
|
}
|
|
}
|
|
|
.margin({ top: 2 ,right:6})
|
|
.margin({ top: 2 ,right:6})
|
|
|
.visibility((this.modeType == 3 && !this.isCanBack)||(this.modeType == 2 && !this.isCanBack)
|
|
.visibility((this.modeType == 3 && !this.isCanBack)||(this.modeType == 2 && !this.isCanBack)
|
|
|
||(this.modeType == 0&&item.type==CommonConstants.TYPE_IS_DIR)? Visibility.None : Visibility.Visible)
|
|
||(this.modeType == 0&&item.type==CommonConstants.TYPE_IS_DIR)? Visibility.None : Visibility.Visible)
|
|
|
Text(StrUtil.isEmpty(item.artist) ? item.duration: item.artist)
|
|
Text(StrUtil.isEmpty(item.artist) ? item.duration: item.artist)
|
|
|
- .fontSize(11)
|
|
|
|
|
- .fontSize(this.twoFingerType == 1 ? 10 : this.twoFingerType == 2 ? 12 : 14)
|
|
|
|
|
|
|
+ .fontSize(this.twoFingerType == 1 ? 10 : this.twoFingerType == 2 ? 12 : 13)
|
|
|
.maxLines(1)
|
|
.maxLines(1)
|
|
|
.textOverflow({ overflow: TextOverflow.MARQUEE })//超长滚动
|
|
.textOverflow({ overflow: TextOverflow.MARQUEE })//超长滚动
|
|
|
- .margin({ top: 2 ,right:18})
|
|
|
|
|
|
|
+ .margin({ top: 2})
|
|
|
.visibility(item.type == CommonConstants.TYPE_IS_ARTIST
|
|
.visibility(item.type == CommonConstants.TYPE_IS_ARTIST
|
|
|
|| item.type == CommonConstants.TYPE_IS_ALBUM
|
|
|| item.type == CommonConstants.TYPE_IS_ALBUM
|
|
|
|| item.type == CommonConstants.TYPE_IS_DIR ? Visibility.None : Visibility.Visible)
|
|
|| item.type == CommonConstants.TYPE_IS_DIR ? Visibility.None : Visibility.Visible)
|
|
@@ -4521,6 +4521,8 @@ export struct LocalMusic {
|
|
|
Text(this.currentSong?.artist)
|
|
Text(this.currentSong?.artist)
|
|
|
.margin({ top: 2 })
|
|
.margin({ top: 2 })
|
|
|
.fontSize(13)
|
|
.fontSize(13)
|
|
|
|
|
+ .maxLines(1)
|
|
|
|
|
+ .textOverflow({ overflow: TextOverflow.MARQUEE })//超长滚动
|
|
|
.fontColor($r('app.color.text_color'))
|
|
.fontColor($r('app.color.text_color'))
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -6481,8 +6483,9 @@ export struct LocalMusic {
|
|
|
console.info("onecold 找到本地歌词 ");
|
|
console.info("onecold 找到本地歌词 ");
|
|
|
}
|
|
}
|
|
|
// 3.读取文件内容并指定编码为 UTF-8
|
|
// 3.读取文件内容并指定编码为 UTF-8
|
|
|
- let file = fs.openSync(realLyricPath, fs.OpenMode.READ_WRITE);
|
|
|
|
|
- let arrayBuffer = new ArrayBuffer(4096);
|
|
|
|
|
|
|
+ let file = fs.openSync(realLyricPath, fs.OpenMode.READ_ONLY);
|
|
|
|
|
+ const stat = await fileIo.stat(file.fd);
|
|
|
|
|
+ const arrayBuffer = new ArrayBuffer(stat.size);
|
|
|
fs.read(file.fd, arrayBuffer)
|
|
fs.read(file.fd, arrayBuffer)
|
|
|
.then((readLen: number) => {
|
|
.then((readLen: number) => {
|
|
|
console.info("read file data succeed");
|
|
console.info("read file data succeed");
|
|
@@ -6621,8 +6624,9 @@ export struct LocalMusic {
|
|
|
console.info("onecold 找到本地歌词");
|
|
console.info("onecold 找到本地歌词");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- let file = fs.openSync(realLyricPath, fs.OpenMode.READ_WRITE);
|
|
|
|
|
- let arrayBuffer = new ArrayBuffer(4096);
|
|
|
|
|
|
|
+ let file = fs.openSync(realLyricPath, fs.OpenMode.READ_ONLY);
|
|
|
|
|
+ const stat = await fileIo.stat(file.fd);
|
|
|
|
|
+ const arrayBuffer = new ArrayBuffer(stat.size);
|
|
|
|
|
|
|
|
const readLen = await fs.read(file.fd, arrayBuffer);
|
|
const readLen = await fs.read(file.fd, arrayBuffer);
|
|
|
console.info("read file data succeed");
|
|
console.info("read file data succeed");
|
|
@@ -9546,7 +9550,6 @@ export struct LocalMusic {
|
|
|
bufferSize = 25 * 1024 * 1024; // 设置缓冲区大小为25MB
|
|
bufferSize = 25 * 1024 * 1024; // 设置缓冲区大小为25MB
|
|
|
}
|
|
}
|
|
|
// 使用软件解码(通常比硬件解码更节省内存)
|
|
// 使用软件解码(通常比硬件解码更节省内存)
|
|
|
- // this.mIjkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec", '0');
|
|
|
|
|
// this.mIjkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec-auto-rotate", '0');
|
|
// this.mIjkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec-auto-rotate", '0');
|
|
|
// this.mIjkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec-handle-resolution-change", '0');
|
|
// this.mIjkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec-handle-resolution-change", '0');
|
|
|
// this.mIjkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "probesize", '1024');
|
|
// this.mIjkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "probesize", '1024');
|