[prev in list] [next in list] [prev in thread] [next in thread]
List: openjdk-openjfx-dev
Subject: Re: [External] : Re: JavaFX 19 - Media object bug
From: Kevin Rushforth <kevin.rushforth () oracle ! com>
Date: 2022-09-17 13:56:12
Message-ID: e30d2a9c-501b-ff99-8a14-1b868b547f82 () oracle ! com
[Download RAW message or body]
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!OeWMVVpaL \
> Y2NEWr0uLfT_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/d1110f479567c314ec \
> b6848700bcf4552509d7e9/modules/javafx.media/src/main/java/com/sun/media/jfxmedia/loc \
> ator/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!OeW \
> MVVpaLY2NEWr0uLfT_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@codedead.com>:
>
> Certainly,
>
> A report has been filed.
>
> Kind regards
>
>
> On Thu, 15 Sep 2022, 18:11 Kevin Rushforth,
> <kevin.rushforth@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!OeWMVVp \
> aLY2NEWr0uLfT_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/d1110f479567c31 \
> > 4ecb6848700bcf4552509d7e9__;!!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@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/j \
> > avafx.media/src/main/java/com/sun/media/jfxmedia/locator/Locator.java__;!!ACWV5N9M \
> > 2RV99hQ!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!O \
> > eWMVVpaLY2NEWr0uLfT_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!OeWMVVpaLY2 \
> > NEWr0uLfT_Z4m_fQyPCpg1VoPzXGJVl4B5NYW5UHkW4FF1w7Q22gqI2nX6OWhogndXvvg6gsuYwdhCBUBA2g$>
> >
>
>
>
> --
> CodeDead Administrator
> https://codedead.com/
> <https://urldefense.com/v3/__https://codedead.com/__;!!ACWV5N9M2RV99hQ!OeWMVVpaLY2NE \
> Wr0uLfT_Z4m_fQyPCpg1VoPzXGJVl4B5NYW5UHkW4FF1w7Q22gqI2nX6OWhogndXvvg6gsuYwdhCBUBA2g$>
>
[Attachment #3 (text/html)]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
Looks like there was a little delay in processing it, so I moved it
to the JDK project myself. It is available here:<br>
<br>
<a class="moz-txt-link-freetext" \
href="https://bugs.openjdk.org/browse/JDK-8293971">https://bugs.openjdk.org/browse/JDK-8293971</a><br>
<br>
I've also added the additional information you sent below to the bug
report.<br>
<br>
-- Kevin<br>
<br>
<br>
<div class="moz-cite-prefix">On 9/16/2022 6:35 PM, Alessandro
Mercier wrote:<br>
</div>
<blockquote type="cite" \
cite="mid:CAEN8YAGQvMzsZ9T0HRYn1Aomt9sRkhXgYCCU8H5vS-P8KnLFZQ@mail.gmail.com">
<div dir="ltr">
<div dir="ltr">Little update:
<div><br>
<div>Filed a bug report at <a \
href="https://urldefense.com/v3/__http://bugreport.java.com__;!!ACWV5N9M2RV99hQ!OeWMVV \
paLY2NEWr0uLfT_Z4m_fQyPCpg1VoPzXGJVl4B5NYW5UHkW4FF1w7Q22gqI2nX6OWhogndXvvg6gsuYwdhn2-IgnQ$" \
moz-do-not-send="true">bugreport.java.com</a> a couple of days ago but it has not \
been created yet.</div> <div>In the in between time I found that this line in the
JFX source is responsible for the bug:</div>
<div><a href="https://urldefense.com/v3/__https://github.com/openjdk/jfx/b \
lob/d1110f479567c314ecb6848700bcf4552509d7e9/modules/javafx.media/src/main/java/com/su \
n/media/jfxmedia/locator/Locator.java*L622__;Iw!!ACWV5N9M2RV99hQ!OeWMVVpaLY2NEWr0uLfT_Z4m_fQyPCpg1VoPzXGJVl4B5NYW5UHkW4FF1w7Q22gqI2nX6OWhogndXvvg6gsuYwdhUNLCS7A$" \
moz-do-not-send="true">https://github.com/openjdk/jfx/blob/d1110f479567c314ecb6848700b \
cf4552509d7e9/modules/javafx.media/src/main/java/com/sun/media/jfxmedia/locator/Locator.java#L622</a><br>
</div>
<div><br>
</div>
<div>Sample code:</div>
<div><br>
</div>
<div>package org.example;<br>
<br>
import javafx.application.Application;<br>
import javafx.scene.Scene;<br>
import javafx.scene.layout.StackPane;<br>
import javafx.scene.media.Media;<br>
import javafx.scene.media.MediaPlayer;<br>
import javafx.stage.Stage;<br>
<br>
import java.net.URISyntaxException;<br>
<br>
public class Main extends Application {<br>
public static void main(String[] args) {<br>
launch(args);<br>
}<br>
<br>
@Override<br>
public void start(final Stage primaryStage) throws
URISyntaxException {<br>
final StackPane root = new StackPane();<br>
primaryStage.setScene(new Scene(root, 300, \
250));<br> primaryStage.show();<br>
<br>
final MediaPlayer player1 = new \
MediaPlayer(new
Media(getClass().getResource("/static.mp3").toURI().toString()));<br>
player1.setAutoPlay(true);<br>
}<br>
}<br>
</div>
<div><br>
</div>
<div>MP3:<br>
<a href="https://urldefense.com/v3/__https://codedead.com/static.mp3__;! \
!ACWV5N9M2RV99hQ!OeWMVVpaLY2NEWr0uLfT_Z4m_fQyPCpg1VoPzXGJVl4B5NYW5UHkW4FF1w7Q22gqI2nX6OWhogndXvvg6gsuYwdhb65LOH4$" \
moz-do-not-send="true">https://codedead.com/static.mp3</a> (royalty free)<br>
</div>
</div>
<div><br>
</div>
<div>Occurrence:</div>
<div>100% of the time</div>
<div><br>
</div>
<div>Kind regards,</div>
<div><br>
</div>
<div>Alessandro Mercier</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Op do 15 sep. 2022 om 18:24
schreef Alessandro Mercier <<a \
href="mailto:administrator@codedead.com" moz-do-not-send="true" \
class="moz-txt-link-freetext">administrator@codedead.com</a>>:<br> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div dir="auto">
<div>Certainly,
<div dir="auto"><br>
</div>
<div dir="auto">A report has been filed.</div>
<div dir="auto"><br>
</div>
<div dir="auto">Kind regards</div>
<br>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, 15 Sep 2022,
18:11 Kevin Rushforth, <<a \
href="mailto:kevin.rushforth@oracle.com" target="_blank" moz-do-not-send="true" \
class="moz-txt-link-freetext">kevin.rushforth@oracle.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px
0px 0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div> This might be a regression introduced by the
fix for <a href="https://bugs.openjdk.org/browse/JDK-8282054" \
rel="noreferrer" target="_blank" moz-do-not-send="true" \
class="moz-txt-link-freetext">https://bugs.openjdk.org/browse/JDK-8282054</a><br> \
<br> Can you file a bug at <a \
href="https://urldefense.com/v3/__https://bugreport.java.com/__;!!ACWV5N9M2RV99hQ!OeWM \
VVpaLY2NEWr0uLfT_Z4m_fQyPCpg1VoPzXGJVl4B5NYW5UHkW4FF1w7Q22gqI2nX6OWhogndXvvg6gsuYwdhkXAhSI4$" \
rel="noreferrer" target="_blank" \
moz-do-not-send="true">https://bugreport.java.com/</a> ?<br>
<br>
Maybe Alexander can comment further.<br>
<br>
-- Kevin<br>
<br>
<br>
<div>On 9/15/2022 8:27 AM, Alessandro Mercier
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hello all,
<div><br>
</div>
<div>After this commit:<br>
<a \
href="https://urldefense.com/v3/__https://github.com/openjdk/jfx/commit/d1110f479567c3 \
14ecb6848700bcf4552509d7e9__;!!ACWV5N9M2RV99hQ!OeWMVVpaLY2NEWr0uLfT_Z4m_fQyPCpg1VoPzXGJVl4B5NYW5UHkW4FF1w7Q22gqI2nX6OWhogndXvvg6gsuYwdhZtzPsZM$" \
rel="noreferrer" target="_blank" \
moz-do-not-send="true">https://github.com/openjdk/jfx/commit/d1110f479567c314ecb6848700bcf4552509d7e9</a><br>
<br>
Creating a new Media object using a MP3 file
in the resources of a project, you can get
exceptions:<br>
<br>
Exception in thread "JavaFX Application
Thread" MediaException: MEDIA_UNSUPPORTED :
Unrecognized file signature!<br>
at <a \
href="mailto:javafx.media@20-ea/javafx.scene.media.Media" rel="noreferrer" \
target="_blank" moz-do-not-send="true" \
class="moz-txt-link-freetext">javafx.media@20-ea/javafx.scene.media.Media</a>.<init>(Media.java:411)<br>
<br>
At first glance, the error is in this
Locator file in the JavaFX source code:<br>
<a \
href="https://urldefense.com/v3/__https://github.com/openjdk/jfx/blob/master/modules/j \
avafx.media/src/main/java/com/sun/media/jfxmedia/locator/Locator.java__;!!ACWV5N9M2RV9 \
9hQ!OeWMVVpaLY2NEWr0uLfT_Z4m_fQyPCpg1VoPzXGJVl4B5NYW5UHkW4FF1w7Q22gqI2nX6OWhogndXvvg6gsuYwdhb7Gu6w0$" \
rel="noreferrer" target="_blank" \
moz-do-not-send="true">https://github.com/openjdk/jfx/blob/master/modules/javafx.media/src/main/java/com/sun/media/jfxmedia/locator/Locator.java</a><br>
</div>
<div><br>
</div>
<div><b>Steps to reproduce the bug:</b></div>
<div>1. Create a new Media object and load an
MP3 from the resources<br>
2. Watch the Media object throw a
MediaException: MEDIA_UNSUPPORTED :
Unrecognized file signature!</div>
<div><br>
</div>
<div><b>Example code that produces the bug:</b></div>
<div>final MediaPlayer mediaPlayer = new
MediaPlayer(new
\
Media(getClass().getResource("/path/to/file.mp3").toExternalForm()));<br> \
<br> <b>Extra:</b><br>
I've made a free MP3 file available to try
with here (royalty free):<br>
<a \
href="https://urldefense.com/v3/__https://codedead.com/static.mp3__;!!ACWV5N9M2RV99hQ! \
OeWMVVpaLY2NEWr0uLfT_Z4m_fQyPCpg1VoPzXGJVl4B5NYW5UHkW4FF1w7Q22gqI2nX6OWhogndXvvg6gsuYwdhb65LOH4$" \
rel="noreferrer" target="_blank" \
moz-do-not-send="true">https://codedead.com/static.mp3</a><br> <br>
I've also got a GIT repository in which the
exception occurs immediately when running
the Gradle task 'application':<br>
<a \
href="https://urldefense.com/v3/__https://github.com/CodeDead/opal/tree/development__; \
!!ACWV5N9M2RV99hQ!OeWMVVpaLY2NEWr0uLfT_Z4m_fQyPCpg1VoPzXGJVl4B5NYW5UHkW4FF1w7Q22gqI2nX6OWhogndXvvg6gsuYwdha9sC5sE$" \
rel="noreferrer" target="_blank" \
moz-do-not-send="true">https://github.com/CodeDead/opal/tree/development</a> (please \
make sure to use the development branch as this branch makes use of the
latest JavaFX versions)</div>
<div><br>
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.<br>
</div>
<div>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.<br>
</div>
<div><br>
</div>
<div>The work-around right now is to revert
back to JavaFX version 18.0.2.</div>
<div><br>
</div>
<div><b>System / OS / Runtime info:</b></div>
<div>Linux Fedora 36<br>
5.19.8-200.fc36.x86_64<br>
openjdk version "18.0.2" 2022-07-19<br>
OpenJDK Runtime Environment
(Red_Hat-18.0.2.0.9-1.rolling.fc36) (build
18.0.2+9)<br>
OpenJDK 64-Bit Server VM
(Red_Hat-18.0.2.0.9-1.rolling.fc36) (build
18.0.2+9, mixed mode, sharing)<br>
</div>
<div>
<div><br>
</div>
<div>Thank you and kind regards</div>
<div><br>
</div>
<div>Alessandro Mercier</div>
-- <br>
<div dir="ltr">
<div dir="ltr">
<div>CodeDead Administrator<br>
</div>
<div><a \
href="https://urldefense.com/v3/__https://codedead.com/__;!!ACWV5N9M2RV99hQ!OeWMVVpaLY \
2NEWr0uLfT_Z4m_fQyPCpg1VoPzXGJVl4B5NYW5UHkW4FF1w7Q22gqI2nX6OWhogndXvvg6gsuYwdhCBUBA2g$" \
rel="noreferrer" target="_blank" \
moz-do-not-send="true">https://codedead.com/</a></div> <div><br>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr" class="gmail_signature">
<div dir="ltr">
<div>CodeDead Administrator<br>
</div>
<div><a href="https://urldefense.com/v3/__https://codedead.com/__;!!ACWV5N \
9M2RV99hQ!OeWMVVpaLY2NEWr0uLfT_Z4m_fQyPCpg1VoPzXGJVl4B5NYW5UHkW4FF1w7Q22gqI2nX6OWhogndXvvg6gsuYwdhCBUBA2g$" \
target="_blank" moz-do-not-send="true">https://codedead.com/</a></div> <div><br>
</div>
</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic