2***@qq.com
2***@qq.com
  • 发布:2024-09-13 17:09
  • 更新:2024-09-13 17:09
  • 阅读:83

【报Bug】Hbuildx 4.26打包后 运行uts ffmpeg插件 报错

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: WIndows10

HBuilderX类型: Alpha

HBuilderX版本号: 4.26

手机系统: Android

手机系统版本号: Android 14

手机厂商: 小米

手机机型: Redmi Note11R

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

示例代码:

<template>
<view class="page">
<view @click="confirmMusicClip"> 裁剪</view>
</view>
</template>

<script>
const app = getApp();
// #ifdef APP-VUE
import {
executeFFmpeg
} from '@/uni_modules/sn-uts-ffmpeg'
// #endif

export default {  
    components: {  

    },  
    data() {  
        return {  
            fullSongFile: '',  
            clipSongOutputDir: '',  

        }     
    },  
    watch: {  

    },  
    computed:{  

    },  
    onLoad(options) {  
        this.downloadMusic()  
    },  
    onShow() {  

    },  
    onHide() {  

    },  
    onUnload() {  

    },  
    created() {  

    },  
    beforeDestroy() {  

    },  
    methods: {  

        downloadMusic(){  
            let mp3_file ="https://cdn.hunque.cn/storage/default/audio_files/34841fb3ba56b93315c3dd5df892cd51fa71d8e6.mp3"   
            let fileName = mp3_file.split('/').pop()  
            let that = this  
            uni.showLoading({  
                title: `正在加载`,  
            })  
            console.warn("downloadMusic",mp3_file,fileName)  

            uni.downloadFile({  
                url: `${mp3_file}`,  
                success(e) {  
                    let {tempFilePath} = e  
                    console.warn('tempFilePath',tempFilePath)  
                    uni.hideLoading()  
                    that.fullSongFile = tempFilePath  

                }  
            })  
        },  
        // 确认使用剪辑的音乐  
        confirmMusicClip(){  
            let that = this  
            let {  
                fullSongFile,  
                clipSongOutputDir,  

            } = this  
            let time = new Date()/1  
            let filePath = `${clipSongOutputDir}${time}.mp3`  
            let real_path = plus.io.convertLocalFileSystemURL(fullSongFile)  
            console.warn("confirmMusicClip",real_path,filePath)  

            uni.showLoading({  
                title: `正在剪裁`,  
                mask: true,  
            })  

            let filter = ``  

            let demoBeginTime = "00:10"  
            let demoEndTime = "00:15"  

            let cmd = `-i ${real_path} -ss ${demoBeginTime} -to ${demoEndTime} ${filter} -f mp3 -acodec copy ${filePath}`  

            console.warn("ffmpeg",cmd)  
            executeFFmpeg(cmd, res => {  
                let {state, returnCode} = res  
                 console.warn("FFmpeg完成回调:",res);  

            }, res => {  
                //   
                console.log(`FFmpeg统计回调`,res)  
            }, res => {  
                 console.log("开始任务回调:" ,res);  
            }, res => {  
                console.log("log回调:" ,res);  
            }, 6000)  

            // console.log('位置',fullSongFile, filePath)  
            // uni.hideLoading()  
            // return  
            console.warn("filePath",filePath)  
            uni.hideLoading()  
            return false;  

        },  

    }  
}  

</script>
<style>
.page{
width: 750rpx;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
</style>

操作步骤:

点击 示例中的 “裁剪”

预期结果:

uts ffmpeg插件 正常执行ffmpeg命令

实际结果:

运行报错Error in v-on handler (Promise/async): "Error: method not found:[uts.sdk.modules.snUtsFfmpeg.IndexKt-executeFFmpegByJs]"

bug描述:

Hbuildx 4.24 打包正常,运行正常
Hbuildx 4.26 打包正常,运行报错Error in v-on handler (Promise/async): "Error: method not found:[uts.sdk.modules.snUtsFfmpeg.IndexKt-executeFFmpegByJs]"

2024-09-13 17:09 负责人:无 分享
已邀请:

要回复问题请先登录注册