Hello Jeff,

I got the same exception with Firefox on macOS.

Two points:
- it seems that duration is not available before the sound is ready to play 
(with Firefox)
- the duration function should return Float

I modify Play_Sound as follow with a waiting loop for readiness:

   procedure Play_Sound (Object : in out Gnoga.Gui.Base.Base_Type'Class) is
      pragma Unreferenced (Object);
   --  Empty;
   begin -- Play_Sound
      Player.Media_Source (Source => "glass.ogg");
      while not Player.Ready_To_Play loop
         Gnoga.Log (Message => Player.Ready_To_Play'Img);
         delay 0.01;
      end loop;
      Gnoga.Log
        (Message => Player.Media_Source & Float'Image (Player.Media_Duration));
      Player.Play;
   exception -- Play_Sound
      when E : others =>
         Gnoga.Log
           (Message =>
              "Play_Sound: " & Ada.Exceptions.Exception_Information (E));
   end Play_Sound;

Results:
2017-09-30 10:42:47.27 : New connection - ID 1
2017-09-30 10:42:49.80 : TRUE
2017-09-30 10:42:49.84 : http://localhost:8080/glass.ogg 7.51836E-01

Note: in my case just one round is needed.

Well, I've had to patch Gnoga for Float and as Ready_To_Play didn't work as 
expected.
Ready_To_Play is based on Javascript readyState:
https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/readyState
Which is not a boolean result but integer.

Here are patches:

Attachment: patch_mm.diff
Description: Binary data



If patches are ok for you I'll push them in Gnoga.
David, is it correct to you also?

PS: Jeff, I'll put Ding into test stuff of Gnoga if you don't mind.

HTH, Pascal.
http://blady.pagesperso-orange.fr


> Le 22 sept. 2017 à 23:01, Jeffrey R. Carter <jrcar...@acm.org> a écrit :
> 
> On 09/22/2017 06:30 PM, Pascal via Gnoga-list wrote:
>> Have you a small test code to try on other configurations?
> 
> This should do it:
> 
> with Ada.Exceptions;
> 
> with Gnoga.Application.Singleton;
> with Gnoga.Gui.Base;
> with Gnoga.Gui.Element.Common;
> with Gnoga.Gui.Element.Multimedia;
> with Gnoga.Gui.View;
> with Gnoga.Gui.Window;
> 
> procedure Ding is
>   Window  : Gnoga.Gui.Window.Window_Type;
>   View    : Gnoga.Gui.View.View_Type;
>   Player  : Gnoga.Gui.Element.Multimedia.Audio_Type;
>   Play    : Gnoga.Gui.Element.Common.Button_Type;
>   Quit    : Gnoga.Gui.Element.Common.Button_Type;
> 
>   procedure Play_Sound (Object : in out Gnoga.Gui.Base.Base_Type'Class) is
>      -- Empty;
>   begin -- Play_Sound
>      Player.Media_Source (Source => "glass.ogg");
>      Gnoga.Log (Message => Player.Media_Source & Integer'Image 
> (Player.Media_Duration) );
>      Player.Play;
>   exception -- Play_Sound
>   when E : others =>
>      Gnoga.Log (Message => "Play_Sound: " & 
> Ada.Exceptions.Exception_Information (E) );
>   end Play_Sound;
> 
> 

<...>

> You can get glass.ogg from Chattanooga. On Firefox, the total time shows as 
> zero
> until the sound has played. Clicking on Play logs
> 
> 2017-09-22 22:30:00.68 : Error jQuery_Execute converting to Integer (forced 
> to 0).
> 2017-09-22 22:30:00.68 : raised CONSTRAINT_ERROR : bad input for 'Value: "NaN"
> Call stack traceback locations:
> 0x7f422f8981c1 0x7f422f896d8e 0x7f422f896dcb 0x55c103624eab 0x55c10361b6f5
> 0x55c1036303c8 0x55c1035e22b7 0x55c10361db1e 0x55c1036213b9 0x55c1036ef22e
> 0x7f422fbc0222 0x7f422ee106d8 0x7f422f12fd7d 0xfffffffffffffffe
> 
> 2017-09-22 22:30:00.73 : http://127.0.0.1:8080/glass.ogg 0
> 
> To my surprise, though, I get similar results on Chromium, including the
> exception msg, except that the total time remains zero after the sound has
> played, too. My larger application displays the total time correctly on
> Chromium. But as it's the behavior on Firefox that interests me, I guess it
> doesn't matter what it does on Chromium.
> 
> HTH
> 
> -- 
> Jeff Carter
> "Blessed is just about anyone with a vested interest in the status quo."
> Monty Python's Life of Brian
> 73
> 
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gnoga-list mailing list
Gnoga-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnoga-list

Reply via email to