Closed jd565 closed 2 years ago
I have the same isssue using 0.10.4 (The issue does not occur with 0.9.1) Have reproduced with API 28, 29 & 30.
Trace:
E/TranscodeEngine: Unexpected error while transcoding.
java.lang.NullPointerException: Attempt to invoke interface method 'boolean com.otaliastudios.transcoder.source.DataSource.isInitialized()' on a null object reference
at com.otaliastudios.transcoder.source.DataSourceWrapper.isInitialized(DataSourceWrapper.java:99)
at com.otaliastudios.transcoder.internal.DataSources.init(DataSources.kt:25)
at com.otaliastudios.transcoder.internal.DataSources.
Code to reproduce:
private var mTranscoderFuture: Future<Void>? = null
fun executeJoinVideoTranscoder(fileList: List<File>, newFile: File) {
val transcoder = Transcoder.into(newFile.absolutePath)
for (file in fileList) {
transcoder.addDataSource(file.absolutePath)
}
transcoder.setListener(object : TranscoderListener {
override fun onTranscodeProgress(progress: Double) {
_videoProgress.postValue(progress)
// Log.i(TAG, "Transcode progress =$progress")
}
override fun onTranscodeCompleted(successCode: Int) {
_joinVideo.postValue(newFile.absolutePath)
Log.i(TAG, "Transcode completed successfully.")
}
override fun onTranscodeCanceled() {
_joinVideo.postValue("CANCEL")
Log.i(TAG, "Transcode cancelled by user.")
}
override fun onTranscodeFailed(exception: Throwable) {
_joinVideo.postValue("ERROR")
Log.i(TAG, "Transcode failed")
}
})
mTranscoderFuture = transcoder.transcode()
}
Also can confirm it is not happening on 0.9.1
when this fix version will release?
when this fix version will release?
I today reproduced this issue. @natario1
Same issue here
Using URI instead of video path fix the issue
Hit this attempting to transcode something from a file path string.
It seems like calling
isInitialized()
hits an NPE as the FilePathDataSource only sets a source once it has been initialized, but checking to see if the data source has been initialized checks if the source (which is still null) has been initialized.I think a simple fix would be to override the
isInitialized
method for FilePathDataSource to check if the source is null first.