sannies / mp4parser

A Java API to read, write and create MP4 files
Apache License 2.0
2.74k stars 563 forks source link

Cast ByteBuffer to Buffer #424

Open ryohey opened 3 years ago

ryohey commented 3 years ago

Thank you for your great library. It works great on Android 10 but we found the problem on Android 8 and 9. I got the following error.

Fatal Exception: java.lang.NoSuchMethodError: No virtual method limit(I)Ljava/nio/ByteBuffer; in class Ljava/nio/ByteBuffer; or its super classes (declaration of 'java.nio.ByteBuffer' appears in /system/framework/core-oj.jar)
       at org.mp4parser.AbstractBoxParser.parseBox(AbstractBoxParser.java:84)
       at org.mp4parser.BasicContainer.initContainer(BasicContainer.java:107)
       at org.mp4parser.IsoFile.<init>(IsoFile.java:57)
       at org.mp4parser.IsoFile.<init>(IsoFile.java:52)
       at org.mp4parser.muxer.container.mp4.MovieCreator.build(MovieCreator.java:54)
       at org.mp4parser.muxer.container.mp4.MovieCreator.build(MovieCreator.java:39)

This seems to be the same problem that fixed in this commit. https://github.com/sannies/mp4parser/commit/0fdd054d7cd65b0328ec685e0e8ac20a16216fe6 I added codes that cast ByteBuffer to Buffer then the problem solved at least on my devices (SC-02H).