wlanjie / trinity

android video record editor muxer sdk
Apache License 2.0
892 stars 271 forks source link

Why OnExportListener not call? #126

Closed tuananhdtu closed 3 years ago

tuananhdtu commented 3 years ago

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);

dongnh311 commented 3 years ago

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

tuananhdtu commented 3 years ago

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);