On 09/30/2017 10:57 AM, Pascal via Gnoga-list wrote: > 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.
OK, with those patches and changing Play_Sound to procedure Play_Sound (Object : in out Gnoga.Gui.Base.Base_Type'Class) is -- Empty; begin -- Play_Sound Player.Media_Source (Source => "glass.ogg"); Wait_For_Ready : loop Gnoga.Log (Message => Integer'Image (Player.Property ("readyState") ) & ' ' & Boolean'Image (Player.Ready_To_Play) ); exit Wait_For_Ready when Player.Ready_To_Play; delay 0.01; end loop Wait_For_Ready; 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; I get 2017-09-30 11:58:16.95 : 0 TRUE 2017-09-30 11:58:17.04 : Error jQuery_Execute converting to Float (forced to 0.0). 2017-09-30 11:58:17.04 : raised CONSTRAINT_ERROR : bad input for 'Value: "Infinity" Call stack traceback locations: 0x7f47fa1091c1 0x7f47fa108958 0x7f47fa108c5b 0x5633f90a0ae0 0x5633f90a0d3a 0x5633f90abc69 0x5633f9079201 0x5633f908fd6d 0x5633f9104751 0x7f47fa431222 0x7f47f96816d8 0x7f47f99a0d7d 0xfffffffffffffffe 2017-09-30 11:58:17.08 : http://localhost:8080/glass.ogg 0.00000E+00 in the log output with Firefox. Also, the thing that is most important to me hasn't changed: the total time isn't displayed in the widget until playback finishes. It looks to me as if Ready_To_Play should probably be Property ("readyState") > 1. > If patches are ok for you I'll push them in Gnoga. Looks OK to me. > PS: Jeff, I'll put Ding into test stuff of Gnoga if you don't mind. Fine with me. -- Jeff Carter "Frankie Wolf, wanted by Federal authorities for dancing with a mailman." Take the Money and Run 143 ------------------------------------------------------------------------------ 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