[External] : Re: JavaFX 19 - Media object bug
Kevin Rushforth
kevin.rushforth at oracle.com
Sat Sep 17 13:56:12 UTC 2022
Looks like there was a little delay in processing it, so I moved it to
the JDK project myself. It is available here:
https://bugs.openjdk.org/browse/JDK-8293971
I've also added the additional information you sent below to the bug report.
-- Kevin
On 9/16/2022 6:35 PM, Alessandro Mercier wrote:
> Little update:
>
> Filed a bug report at bugreport.java.com
> <https://urldefense.com/v3/__http://bugreport.java.com__;!!ACWV5N9M2RV99hQ!OeWMVVpaLY2NEWr0uLfT_Z4m_fQyPCpg1VoPzXGJVl4B5NYW5UHkW4FF1w7Q22gqI2nX6OWhogndXvvg6gsuYwdhn2-IgnQ$>
> a couple of days ago but it has not been created yet.
> In the in between time I found that this line in the JFX source is
> responsible for the bug:
> https://github.com/openjdk/jfx/blob/d1110f479567c314ecb6848700bcf4552509d7e9/modules/javafx.media/src/main/java/com/sun/media/jfxmedia/locator/Locator.java#L622
> <https://urldefense.com/v3/__https://github.com/openjdk/jfx/blob/d1110f479567c314ecb6848700bcf4552509d7e9/modules/javafx.media/src/main/java/com/sun/media/jfxmedia/locator/Locator.java*L622__;Iw!!ACWV5N9M2RV99hQ!OeWMVVpaLY2NEWr0uLfT_Z4m_fQyPCpg1VoPzXGJVl4B5NYW5UHkW4FF1w7Q22gqI2nX6OWhogndXvvg6gsuYwdhUNLCS7A$>
>
> Sample code:
>
> package org.example;
>
> import javafx.application.Application;
> import javafx.scene.Scene;
> import javafx.scene.layout.StackPane;
> import javafx.scene.media.Media;
> import javafx.scene.media.MediaPlayer;
> import javafx.stage.Stage;
>
> import java.net.URISyntaxException;
>
> public class Main extends Application {
> public static void main(String[] args) {
> launch(args);
> }
>
> @Override
> public void start(final Stage primaryStage) throws
> URISyntaxException {
> final StackPane root = new StackPane();
> primaryStage.setScene(new Scene(root, 300, 250));
> primaryStage.show();
>
> final MediaPlayer player1 = new MediaPlayer(new
> Media(getClass().getResource("/static.mp3").toURI().toString()));
> player1.setAutoPlay(true);
> }
> }
>
> MP3:
> https://codedead.com/static.mp3
> <https://urldefense.com/v3/__https://codedead.com/static.mp3__;!!ACWV5N9M2RV99hQ!OeWMVVpaLY2NEWr0uLfT_Z4m_fQyPCpg1VoPzXGJVl4B5NYW5UHkW4FF1w7Q22gqI2nX6OWhogndXvvg6gsuYwdhb65LOH4$>
> (royalty free)
>
> Occurrence:
> 100% of the time
>
> Kind regards,
>
> Alessandro Mercier
>
> Op do 15 sep. 2022 om 18:24 schreef Alessandro Mercier
> <administrator at codedead.com>:
>
> Certainly,
>
> A report has been filed.
>
> Kind regards
>
>
> On Thu, 15 Sep 2022, 18:11 Kevin Rushforth,
> <kevin.rushforth at oracle.com> wrote:
>
> This might be a regression introduced by the fix for
> https://bugs.openjdk.org/browse/JDK-8282054
>
> Can you file a bug at https://bugreport.java.com/
> <https://urldefense.com/v3/__https://bugreport.java.com/__;!!ACWV5N9M2RV99hQ!OeWMVVpaLY2NEWr0uLfT_Z4m_fQyPCpg1VoPzXGJVl4B5NYW5UHkW4FF1w7Q22gqI2nX6OWhogndXvvg6gsuYwdhkXAhSI4$>
> ?
>
> Maybe Alexander can comment further.
>
> -- Kevin
>
>
> On 9/15/2022 8:27 AM, Alessandro Mercier wrote:
>> Hello all,
>>
>> After this commit:
>> https://github.com/openjdk/jfx/commit/d1110f479567c314ecb6848700bcf4552509d7e9
>> <https://urldefense.com/v3/__https://github.com/openjdk/jfx/commit/d1110f479567c314ecb6848700bcf4552509d7e9__;!!ACWV5N9M2RV99hQ!OeWMVVpaLY2NEWr0uLfT_Z4m_fQyPCpg1VoPzXGJVl4B5NYW5UHkW4FF1w7Q22gqI2nX6OWhogndXvvg6gsuYwdhZtzPsZM$>
>>
>> Creating a new Media object using a MP3 file in the resources
>> of a project, you can get exceptions:
>>
>> Exception in thread "JavaFX Application Thread"
>> MediaException: MEDIA_UNSUPPORTED : Unrecognized file signature!
>> at
>> javafx.media at 20-ea/javafx.scene.media.Media.<init>(Media.java:411)
>>
>> At first glance, the error is in this Locator file in the
>> JavaFX source code:
>> https://github.com/openjdk/jfx/blob/master/modules/javafx.media/src/main/java/com/sun/media/jfxmedia/locator/Locator.java
>> <https://urldefense.com/v3/__https://github.com/openjdk/jfx/blob/master/modules/javafx.media/src/main/java/com/sun/media/jfxmedia/locator/Locator.java__;!!ACWV5N9M2RV99hQ!OeWMVVpaLY2NEWr0uLfT_Z4m_fQyPCpg1VoPzXGJVl4B5NYW5UHkW4FF1w7Q22gqI2nX6OWhogndXvvg6gsuYwdhb7Gu6w0$>
>>
>> *Steps to reproduce the bug:*
>> 1. Create a new Media object and load an MP3 from the resources
>> 2. Watch the Media object throw a MediaException:
>> MEDIA_UNSUPPORTED : Unrecognized file signature!
>>
>> *Example code that produces the bug:*
>> final MediaPlayer mediaPlayer = new MediaPlayer(new
>> Media(getClass().getResource("/path/to/file.mp3").toExternalForm()));
>>
>> *Extra:*
>> I've made a free MP3 file available to try with here (royalty
>> free):
>> https://codedead.com/static.mp3
>> <https://urldefense.com/v3/__https://codedead.com/static.mp3__;!!ACWV5N9M2RV99hQ!OeWMVVpaLY2NEWr0uLfT_Z4m_fQyPCpg1VoPzXGJVl4B5NYW5UHkW4FF1w7Q22gqI2nX6OWhogndXvvg6gsuYwdhb65LOH4$>
>>
>> I've also got a GIT repository in which the exception occurs
>> immediately when running the Gradle task 'application':
>> https://github.com/CodeDead/opal/tree/development
>> <https://urldefense.com/v3/__https://github.com/CodeDead/opal/tree/development__;!!ACWV5N9M2RV99hQ!OeWMVVpaLY2NEWr0uLfT_Z4m_fQyPCpg1VoPzXGJVl4B5NYW5UHkW4FF1w7Q22gqI2nX6OWhogndXvvg6gsuYwdha9sC5sE$>
>> (please make sure to use the development branch as this
>> branch makes use of the latest JavaFX versions)
>>
>> Oddly enough, it does not always happen, and loading the file
>> directly from a file location instead of the project
>> resources seems to work, but when loading from the resources,
>> you get the exception that the media file signature is not
>> recognized.
>> I don't see a problem with the media files themselves,
>> encoding is all fine, at first glance and because it worked
>> in JavaFX 18.0.2, creating a Media object using a URI to a
>> project resources location should work in newer versions as
>> well, I think. The same MP3 file does work when you load it
>> from the disk instead of the project resources so this makes
>> it a bug, I believe.
>>
>> The work-around right now is to revert back to JavaFX version
>> 18.0.2.
>>
>> *System / OS / Runtime info:*
>> Linux Fedora 36
>> 5.19.8-200.fc36.x86_64
>> openjdk version "18.0.2" 2022-07-19
>> OpenJDK Runtime Environment
>> (Red_Hat-18.0.2.0.9-1.rolling.fc36) (build 18.0.2+9)
>> OpenJDK 64-Bit Server VM (Red_Hat-18.0.2.0.9-1.rolling.fc36)
>> (build 18.0.2+9, mixed mode, sharing)
>>
>> Thank you and kind regards
>>
>> Alessandro Mercier
>> --
>> CodeDead Administrator
>> https://codedead.com/
>> <https://urldefense.com/v3/__https://codedead.com/__;!!ACWV5N9M2RV99hQ!OeWMVVpaLY2NEWr0uLfT_Z4m_fQyPCpg1VoPzXGJVl4B5NYW5UHkW4FF1w7Q22gqI2nX6OWhogndXvvg6gsuYwdhCBUBA2g$>
>>
>
>
>
> --
> CodeDead Administrator
> https://codedead.com/
> <https://urldefense.com/v3/__https://codedead.com/__;!!ACWV5N9M2RV99hQ!OeWMVVpaLY2NEWr0uLfT_Z4m_fQyPCpg1VoPzXGJVl4B5NYW5UHkW4FF1w7Q22gqI2nX6OWhogndXvvg6gsuYwdhCBUBA2g$>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20220917/5a51e28d/attachment-0001.htm>
More information about the openjfx-dev
mailing list