|
|
@@ -3497,6 +3497,40 @@ export struct LocalMusic {
|
|
|
}
|
|
|
.layoutWeight(1)
|
|
|
.height('100%')
|
|
|
+ //拖拽pc或者pad的用鼠标拖拽音乐和视频到List或Grid上自动导入视频
|
|
|
+ .allowDrop([uniformTypeDescriptor.UniformDataType.AUDIO,uniformTypeDescriptor.UniformDataType.VIDEO])
|
|
|
+ .onDrop((event?: DragEvent) => {
|
|
|
+ try {
|
|
|
+ let dragData: UnifiedData = (event as DragEvent).getData() as UnifiedData;
|
|
|
+ if (dragData !== undefined) {
|
|
|
+ let records: unifiedDataChannel.UnifiedRecord[] = dragData.getRecords();
|
|
|
+ if (records.length > 0) {
|
|
|
+ for (let i = 0; i < records.length; i++) {
|
|
|
+ let types = records[i].getTypes();
|
|
|
+ if (types.includes(uniformTypeDescriptor.UniformDataType.FILE_URI)) {
|
|
|
+ const fileUriUds =
|
|
|
+ records[i].getEntry(uniformTypeDescriptor.UniformDataType.FILE_URI) as uniformDataStruct.FileUri;
|
|
|
+ let typeDescriptor = uniformTypeDescriptor.getTypeDescriptor(fileUriUds.fileType);
|
|
|
+ if (typeDescriptor.belongsTo(uniformTypeDescriptor.UniformDataType.AUDIO)
|
|
|
+ ||typeDescriptor.belongsTo(uniformTypeDescriptor.UniformDataType.VIDEO)) {
|
|
|
+ this.targetFile = fileUriUds.oriUri;
|
|
|
+ this.saveVideoDatas([this.targetFile])
|
|
|
+ hilog.info(0x0000, 'Heanup', '当前targetFile:' + this.targetFile);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ hilog.info(0x0000, TAG, `%{public}s`, `dragData arr is null`);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ hilog.info(0x0000, TAG, `%{public}s`, `dragData is undefined`);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (error) {
|
|
|
+ const err = error as BusinessError;
|
|
|
+ hilog.error(0x0000, TAG, `startDataLoading errorCode: ${err.code}, errorMessage: ${err.message}`);
|
|
|
+ }
|
|
|
+ })
|
|
|
// 右侧居中的字母表索引
|
|
|
this.indexBuilder()
|
|
|
|
|
|
@@ -5551,43 +5585,6 @@ export struct LocalMusic {
|
|
|
return { offsetRemain: offset };
|
|
|
})
|
|
|
|
|
|
- //允许拖拽音乐和视频到List或Grid上自动导入视频
|
|
|
- .allowDrop([uniformTypeDescriptor.UniformDataType.AUDIO,uniformTypeDescriptor.UniformDataType.VIDEO])
|
|
|
- .onDrop((event?: DragEvent) => {
|
|
|
- try {
|
|
|
- let dragData: UnifiedData = (event as DragEvent).getData() as UnifiedData;
|
|
|
- if (dragData !== undefined) {
|
|
|
- let records: unifiedDataChannel.UnifiedRecord[] = dragData.getRecords();
|
|
|
- if (records.length > 0) {
|
|
|
- for (let i = 0; i < records.length; i++) {
|
|
|
- let types = records[i].getTypes();
|
|
|
- if (types.includes(uniformTypeDescriptor.UniformDataType.FILE_URI)) {
|
|
|
- const fileUriUds =
|
|
|
- records[i].getEntry(uniformTypeDescriptor.UniformDataType.FILE_URI) as uniformDataStruct.FileUri;
|
|
|
- let typeDescriptor = uniformTypeDescriptor.getTypeDescriptor(fileUriUds.fileType);
|
|
|
- if (typeDescriptor.belongsTo(uniformTypeDescriptor.UniformDataType.AUDIO)
|
|
|
- ||typeDescriptor.belongsTo(uniformTypeDescriptor.UniformDataType.VIDEO)) {
|
|
|
- this.targetFile = fileUriUds.oriUri;
|
|
|
- this.saveVideoDatas([this.targetFile])
|
|
|
- hilog.info(0x0000, 'Heanup', '当前targetFile:' + this.targetFile);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- hilog.info(0x0000, TAG, `%{public}s`, `dragData arr is null`);
|
|
|
- }
|
|
|
- } else {
|
|
|
- hilog.info(0x0000, TAG, `%{public}s`, `dragData is undefined`);
|
|
|
- }
|
|
|
-
|
|
|
- } catch (error) {
|
|
|
- const err = error as BusinessError;
|
|
|
- hilog.error(0x0000, TAG, `startDataLoading errorCode: ${err.code}, errorMessage: ${err.message}`);
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -5945,40 +5942,7 @@ export struct LocalMusic {
|
|
|
|
|
|
return { offsetRemain: offset };
|
|
|
})
|
|
|
- .allowDrop([uniformTypeDescriptor.UniformDataType.AUDIO,uniformTypeDescriptor.UniformDataType.VIDEO])
|
|
|
- .onDrop((event?: DragEvent) => {
|
|
|
- try {
|
|
|
- let dragData: UnifiedData = (event as DragEvent).getData() as UnifiedData;
|
|
|
- if (dragData !== undefined) {
|
|
|
- let records: unifiedDataChannel.UnifiedRecord[] = dragData.getRecords();
|
|
|
- if (records.length > 0) {
|
|
|
- for (let i = 0; i < records.length; i++) {
|
|
|
- let types = records[i].getTypes();
|
|
|
- if (types.includes(uniformTypeDescriptor.UniformDataType.FILE_URI)) {
|
|
|
- const fileUriUds =
|
|
|
- records[i].getEntry(uniformTypeDescriptor.UniformDataType.FILE_URI) as uniformDataStruct.FileUri;
|
|
|
- let typeDescriptor = uniformTypeDescriptor.getTypeDescriptor(fileUriUds.fileType);
|
|
|
- if (typeDescriptor.belongsTo(uniformTypeDescriptor.UniformDataType.AUDIO)
|
|
|
- ||typeDescriptor.belongsTo(uniformTypeDescriptor.UniformDataType.VIDEO)) {
|
|
|
- this.targetFile = fileUriUds.oriUri;
|
|
|
- this.saveVideoDatas([this.targetFile])
|
|
|
- hilog.info(0x0000, 'Heanup', '当前targetFile:' + this.targetFile);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- hilog.info(0x0000, TAG, `%{public}s`, `dragData arr is null`);
|
|
|
- }
|
|
|
- } else {
|
|
|
- hilog.info(0x0000, TAG, `%{public}s`, `dragData is undefined`);
|
|
|
- }
|
|
|
-
|
|
|
- } catch (error) {
|
|
|
- const err = error as BusinessError;
|
|
|
- hilog.error(0x0000, TAG, `startDataLoading errorCode: ${err.code}, errorMessage: ${err.message}`);
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
+
|
|
|
|
|
|
}
|
|
|
@State targetFile: string = '';
|
|
|
@@ -6456,6 +6420,7 @@ export struct LocalMusic {
|
|
|
.width(180)
|
|
|
}
|
|
|
.height('auto')
|
|
|
+ .enableScrollInteraction(true)
|
|
|
.scrollBar(this.isGridMusic?BarState.On:BarState.Off)
|
|
|
}
|
|
|
|
|
|
@@ -6809,40 +6774,7 @@ export struct LocalMusic {
|
|
|
return { offsetRemain: offset };
|
|
|
})
|
|
|
|
|
|
- //拖拽pc或者pad的用鼠标拖拽音乐和视频到List或Grid上自动导入视频
|
|
|
- .allowDrop([uniformTypeDescriptor.UniformDataType.AUDIO,uniformTypeDescriptor.UniformDataType.VIDEO])
|
|
|
- .onDrop((event?: DragEvent) => {
|
|
|
- try {
|
|
|
- let dragData: UnifiedData = (event as DragEvent).getData() as UnifiedData;
|
|
|
- if (dragData !== undefined) {
|
|
|
- let records: unifiedDataChannel.UnifiedRecord[] = dragData.getRecords();
|
|
|
- if (records.length > 0) {
|
|
|
- for (let i = 0; i < records.length; i++) {
|
|
|
- let types = records[i].getTypes();
|
|
|
- if (types.includes(uniformTypeDescriptor.UniformDataType.FILE_URI)) {
|
|
|
- const fileUriUds =
|
|
|
- records[i].getEntry(uniformTypeDescriptor.UniformDataType.FILE_URI) as uniformDataStruct.FileUri;
|
|
|
- let typeDescriptor = uniformTypeDescriptor.getTypeDescriptor(fileUriUds.fileType);
|
|
|
- if (typeDescriptor.belongsTo(uniformTypeDescriptor.UniformDataType.AUDIO)
|
|
|
- ||typeDescriptor.belongsTo(uniformTypeDescriptor.UniformDataType.VIDEO)) {
|
|
|
- this.targetFile = fileUriUds.oriUri;
|
|
|
- this.saveVideoDatas([this.targetFile])
|
|
|
- hilog.info(0x0000, 'Heanup', '当前targetFile:' + this.targetFile);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- hilog.info(0x0000, TAG, `%{public}s`, `dragData arr is null`);
|
|
|
- }
|
|
|
- } else {
|
|
|
- hilog.info(0x0000, TAG, `%{public}s`, `dragData is undefined`);
|
|
|
- }
|
|
|
|
|
|
- } catch (error) {
|
|
|
- const err = error as BusinessError;
|
|
|
- hilog.error(0x0000, TAG, `startDataLoading errorCode: ${err.code}, errorMessage: ${err.message}`);
|
|
|
- }
|
|
|
- })
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -13604,7 +13536,7 @@ export struct LocalMusic {
|
|
|
//启动预加载
|
|
|
this.mIjkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "start-on-prepared", "1");
|
|
|
// 设置无缓冲,这是播放器的缓冲区,有数据就播放
|
|
|
- this.mIjkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "packet-buffering", "1");
|
|
|
+ this.mIjkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "packet-buffering", "0");
|
|
|
//跳帧处理,放CPU处理较慢时,进行跳帧处理,保证播放流程,画面和声音同步
|
|
|
this.mIjkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "framedrop", "5");
|
|
|
// 最大缓冲cache是3s, 有时候网络波动,会突然在短时间内收到好几秒的数据
|