wlanjie/trinity

Why OnExportListener not call?

tuananhdtu opened this issue · 2 comments

TrinityVideoEditor videoEditor = TrinityCore.INSTANCE.createEditor(this);
videoEditor.insertClip(new MediaClip("/sdcard/export.mp4", new TimeRange(0, duration)));
JSONObject jsonObject = new JSONObject();
jsonObject.put("path", "/storage/emulated/0/beatforvideo.mp3");
videoEditor.addMusic(jsonObject.toString());
VideoExportInfo info = new VideoExportInfo("/sdcard/export.mp4");
info.setMediaCodecEncode(true);
info.setMediaCodecDecode(true);
info.setWidth(720);
info.setHeight(720);
info.setVideoBitRate(2000);
info.setFrameRate(25);
info.setSampleRate(44100);
info.setChannelCount(1);
info.setAudioBitRate(0);
VideoExport mVideoExport = TrinityCore.INSTANCE.createExport(OtherActivity.this);
mVideoExport.export(info, OtherActivity.this);

Are you use version 0.2.9.1?
If right, you need call videoEditor play first, I finished handling the issue using this method

Yes, i use version 0.2.9.1

I add code videoEditor play but OnExportListener not work

TrinityVideoEditor videoEditor = TrinityCore.INSTANCE.createEditor(this);
videoEditor.insertClip(new MediaClip("/sdcard/export.mp4", new TimeRange(0, duration)));
JSONObject jsonObject = new JSONObject();
jsonObject.put("path", "/storage/emulated/0/beatforvideo.mp3");
videoEditor.addMusic(jsonObject.toString());
int result = videoEditor.play(false);
if (result != 0) {
Toast.makeText(this, "error", Toast.LENGTH_SHORT).show();
}
VideoExportInfo info = new VideoExportInfo("/sdcard/export.mp4");
info.setMediaCodecEncode(true);
info.setMediaCodecDecode(true);
info.setWidth(720);
info.setHeight(720);
info.setVideoBitRate(2000);
info.setFrameRate(25);
info.setSampleRate(44100);
info.setChannelCount(1);
info.setAudioBitRate(0);
VideoExport mVideoExport = TrinityCore.INSTANCE.createExport(OtherActivity.this);
mVideoExport.export(info, OtherActivity.this);