|
@@ -19,9 +19,11 @@ import com.bomostory.sceneeditmodule.share.ExportPdfDialog
|
|
import com.bomostory.sceneeditmodule.share.ShareDialog
|
|
import com.bomostory.sceneeditmodule.share.ShareDialog
|
|
import com.bomostory.sceneeditmodule.utils.MoviePlayer
|
|
import com.bomostory.sceneeditmodule.utils.MoviePlayer
|
|
import com.bomostory.sceneeditmodule.utils.MusicPlayer
|
|
import com.bomostory.sceneeditmodule.utils.MusicPlayer
|
|
|
|
+import com.bomostory.sceneeditmodule.utils.TimeUtils
|
|
import com.bomostory.sceneeditmodule.view.AudioTrackGroupView
|
|
import com.bomostory.sceneeditmodule.view.AudioTrackGroupView
|
|
import com.bomostory.sceneeditmodule.view.MovieSelectView
|
|
import com.bomostory.sceneeditmodule.view.MovieSelectView
|
|
import com.example.exportmedia.MediaHelper
|
|
import com.example.exportmedia.MediaHelper
|
|
|
|
+import com.example.exportmedia.audio.AudioEditor
|
|
import com.example.tfat.myapplication.R
|
|
import com.example.tfat.myapplication.R
|
|
import com.google.gson.Gson
|
|
import com.google.gson.Gson
|
|
import io.reactivex.Observable
|
|
import io.reactivex.Observable
|
|
@@ -80,6 +82,26 @@ class MovieEditActivity : AppCompatActivity(),
|
|
musicPlayer.stop()
|
|
musicPlayer.stop()
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ override fun onMusicEditFinish(music: Music) {
|
|
|
|
+ if (music.endTime - music.startTime > moviePlayer.totalPeriod) {
|
|
|
|
+ music.endTime = music.startTime + moviePlayer.totalPeriod
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ val builder = AudioEditor.Builder(mediaHelper)
|
|
|
|
+ builder.editAudioFile = File(music.path)
|
|
|
|
+ builder.startTime = TimeUtils.getEncodeTimeFormt(music.startTime)
|
|
|
|
+ builder.endTime = TimeUtils.getEncodeTimeFormt(music.endTime)
|
|
|
|
+ builder.volume = music.volume
|
|
|
|
+
|
|
|
|
+ val fileName = "test${System.currentTimeMillis()}.mp3"
|
|
|
|
+ val outputFile = File(Environment.getExternalStorageDirectory(), fileName)
|
|
|
|
+ val audioEditor = builder.build()
|
|
|
|
+ audioEditor.output(outputFile).subscribe({
|
|
|
|
+ }, {
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
override fun onDismiss(dialog: DialogInterface?) {
|
|
override fun onDismiss(dialog: DialogInterface?) {
|
|
musicPlayer.stop()
|
|
musicPlayer.stop()
|
|
musicPlayer.release()
|
|
musicPlayer.release()
|