Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法获取都出文件的回调? #1

Open
bobo19870225 opened this issue Nov 1, 2021 · 1 comment
Open

无法获取都出文件的回调? #1

bobo19870225 opened this issue Nov 1, 2021 · 1 comment

Comments

@bobo19870225
Copy link

bobo19870225 commented Nov 1, 2021

demo中无法获取导出文件时的回调,通过阅读源码发现以下方法可行:

 a a = com.huawei.hms.audioeditor.ui.common.a.a();
        AudioExportCallBack audioExportCallBack = a.b();
        if (audioExportCallBack == null) {

            audioExportCallBack = new AudioExportCallBack() {
                @Override
                public void onAudioExportSuccess(AudioInfo audioInfo) {
                    Log.e("TAG", "onAudioExportSuccess: " + audioInfo);
                    startSelf();//返回主页
                }

                @Override
                public void onAudioExportFailed(int i) {
                    Log.e("TAG", "onAudioExportSuccess: " + i);
                }
            };
            ReflexUtil.setFieldValueByFieldName(a, "b", audioExportCallBack);
        }

 public static void setFieldValueByFieldName(Object object, String fieldName, Object value) {
        try {
            // 获取obj类的字节文件对象
            Class<?> c = object.getClass();
            // 获取该类的成员变量
            Field field = c.getDeclaredField(fieldName);
            // 取消语言访问检查
            field.setAccessible(true);
            // 给变量赋值
            field.set(object, value);
        } catch (Exception e) {
            Log.e(TAG, "setFieldValueByFieldName: ", e);
        }
    }

源码中在导出文件的Activity中设置了回调,但是没有给出set方法并且回调接口是私有属性,唯有通过反射方能设置回调。希望官方修复这个问题

@zhouqiangqian
Copy link

这个目前是预留的回调,一些基础功能下个版本会逐渐开放

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants