Video doesn't play on iOS or Mac after compress
See original GitHub issueI am using this library for one of my project and I discover one issue when i compress video using this library and try to play on iPhone or Safari browser.
Original video: https://drive.google.com/file/d/1MXmwkjxB8WKX6_Rf78JXZ1E6W4yg639a/view?usp=sharing Compressed video: https://drive.google.com/file/d/1zdX8gUgrEoGttWifHh_2JZP3hZqncSq7/view?usp=sharing
When we try to play this video in quick time player, It showing following error alert:
- LightCompressor version: 0.7.8
- Device: Nokia 6.1 Plus - 10.0
- Code:
val sourceFile = File(video.url)
val destinationFile =
File(context.cacheDir.absolutePath + "/" + sourceFile.name)
VideoCompressor.start(
srcPath = sourceFile.path,
destPath = destinationFile.path,
quality = VideoQuality.HIGH,
isMinBitRateEnabled = false,
listener = object : CompressionListener {
override fun onCancelled() {
if (isCancelled) return
isCancelled = true
emitter.onError(UnknownErrorException("Video compression process cancelled"))
emitter.onComplete()
}
override fun onFailure(failureMessage: String) {
VideoCompressor.cancel()
if (isCancelled) return
isCancelled = true
emitter.onError(UnknownErrorException(failureMessage))
emitter.onComplete()
}
override fun onProgress(percent: Float) {
//Do nothing
}
override fun onStart() {
//Do nothing
}
override fun onSuccess() {
if (isCancelled) return
compressedVideoMediaList.add(Video(destinationFile.path))
if (videoMediaList.size == compressedVideoMediaList.size) {
emitter.onNext(compressedVideoMediaList.toList())
emitter.onComplete()
}
}
},
)
@AbedElazizShe Can you please help me here to figure out this issue? Let me know if you need any other details from my end.
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (6 by maintainers)
Top Results From Across the Web
If an audio or video file doesn't play on Mac - Apple Support
If an audio or video file doesn't play on Mac. Older or specialized media formats might require other software. Apple apps such as...
Read more >How to Fix HD/4K Videos Won't Play on iPhone (14 or 13)
This guide offers solutions when iPhone won't play 4K/HD videos whether they are from camera roll, Facebook, Safari, Mac, Windows, GoPro, ...
Read more >What's the best way to compress videos on Mac? - Setapp
Compare a few apps that can compress a video on Mac and reduce video size, ... Compress, crop, convert, play, and edit videos...
Read more >All the Best Ways to Compress Videos on a Mac - MacKeeper
Compressing videos using QuickTime Player · Launch QuickTime Player · Use the file browser to select the video you want to compress ·...
Read more >How to reduce video size (compress video) on Mac - MacPaw
Since a video is just a series of photos rapidly playing in succession, ... reducing video file size on Mac doesn't have to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Issue fixed in version 0.8.1. Please let me know if you still have the issue. You can close the task if the problem is solved.
Still didn’t work on version 1.0.0. Replaced line
val encoder = if (hasQTI) { MediaCodec.createByCodecName(“c2.android.avc.encoder”) } else { MediaCodec.createEncoderByType(MIME_TYPE) }
with val encoder = MediaCodec.createEncoderByType(MIME_TYPE)
now all is good