korge icon indicating copy to clipboard operation
korge copied to clipboard

Korvi not found/published with Korge 3.0.0-Beta*

Open zhanghai opened this issue 3 years ago • 6 comments

There is KorgeExtension.supportVideo(), but using it results in a dependency resolution failure. I couldn't find korvi under korge2 on MavenCentral either.

zhanghai avatar Jul 11 '22 03:07 zhanghai

Yeah, the only artifact provided is korvi. Probably the korge-korvi artifact was dropped at some point: https://search.maven.org/search?q=g:com.soywiz.korlibs.korvi%20a:korvi

Related code: https://github.com/korlibs/korge/blob/78125b99e432601479e0454ec31f67fc4a5bd395/buildSrc/src/main/kotlin/com/soywiz/korge/gradle/KorgeExtension.kt#L442

I will probably replace it with a source-code dependency like the ones in https://awesome.korge.org/ and will update the support to include it.

Thanks for reporting!

soywiz avatar Jul 11 '22 07:07 soywiz

Could you elaborate on the reason for replacing it with a source code dependency? Playing videos may still be an important part of a game (not all games can use real time CG to achive the same effect as prerendered videos), so it would be nice if it can still be an easy-to-integrate official binary dependency of Korge.

zhanghai avatar Jul 11 '22 08:07 zhanghai

The plan is to keep the supportKorvi method, but instead of loading a full KMM library that takes like a lot of files/artifacts, the idea is to download a small piece of source code and compile it on the fly. In the end that artifact would be maybe 1 or 2 classes and a few lines of code for a common source set, so for me it is a bit too much to compile artifacts for every single possible platform. At some point I expect proper multiplatform klib will be supported and only uploading a single .klib file. In any case, for the final consumer it should be the same.

soywiz avatar Jul 11 '22 09:07 soywiz

I see. I'm still new to KMM and couldn't understand why local compilation will require less effort than the same code being precompiled (assuming the files/artifacts for each platform are built and uploaded by scripts), but I guess you know this far better than me. And glad to hear that it will be the same for us consumers, so thanks for the clarification and the work on this project!

zhanghai avatar Jul 11 '22 09:07 zhanghai

Note that I was able integrate Korvi with Korge 3.0.0 Beta by manually specifying the dependency:

dependencyMulti("com.soywiz.korlibs.korvi:korvi:${BuildVersions.KORGE}", registerPlugin = false)

Korvi works fine in the browser, but when I was playing a 2K 60FPS MP4 file on JVM (on a reasaonbly performant desktop) it gives me only 8 FPS and no sound. I assume the reason is that Korvi on JVM is using a software decoder and doesn't support AAC audio. It seems to me hardware decoding is almost mandatory nowadays to support modern videos, so I guess I may need to find something else for videos 🤔

zhanghai avatar Jul 14 '22 02:07 zhanghai

Yeah, on the JVM it uses a JVM library for mp4 decoding. Korvi is pretty experimental, though it would be possible to plug libavcodec and other other libraries from ffmpeg to do that, or plug to each operating system functionality, or compile ffmpeg with wasm, and load it in the JVM. I wanted something portable despite the performance/encoding so the initial implementation was like that. There is another thing in the roadmap that should be just a few hours of work: https://github.com/korlibs/korge/issues/535 despite probably not for 2K, and not space-efficient. In any case updating this myself is not in my short-term roadmap; but contributions are welcome.

soywiz avatar Jul 14 '22 11:07 soywiz