Hello Jeff and Jeremiah,

Well Gnoga is a bit rigid or obscur on that issue.
Between different browsers behaviors, OS, Gnoga and my program code, I spent 
hours to test many configurations.
Besides the fact that in my case ogg files are not recognized by Safari!

What matters?
- the location of the executable
- the URL path in the program code, absolute or relative (think HTML code)
- the Gnoga environnement directories: html, img and so on

My configuration:
- executable in bin directory
- ressource in img directory
- code:    Audio.Create (Main_View, "img/tune.mp3");

Result:
cmd$ ~/documents/hello/bin/hello5_av 
Gnoga            :1.3-alpha
Application root :/Users/me/documents/hello/
Executable at    :/Users/me/documents/hello/bin/
HTML root        :/Users/me/documents/hello/html/
Upload directory :/Users/me/documents/hello/html/
Templates root   :/Users/me/documents/hello/
/js  at          :/Users/me/documents/hello/js/
/css at          :/Users/me/documents/hello/css/
/img at          :/Users/me/documents/hello/img/
Boot file        :boot.html
HTTP listen on   ::8080
2017-09-16 10:57:44.57 : HTTP Server Started
2017-09-16 10:58:10.88 : New connection - ID 1
2017-09-16 10:58:11.57 : The browser can play MP3s? - TRUE
2017-09-16 10:58:11.70 : The browser can play MP4s? - TRUE

Gnoga recognizes executable in bin directory and thus sets its root directory 
for relative paths.

See full code on:
https://github.com/Blady-Com/Exemples-PPAG/blob/master/src/hello5_av.adb
And related tuto (in French):
http://blady.pagesperso-orange.fr/telechargements/gnoga/gnoga_wf.pdf

Other paths have to be valid (work) in HTML before transpose in Gnoga 
environment.

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


> Le 16 sept. 2017 à 01:23, Jeremiah Breeden <jeremiah.bree...@gmail.com> a 
> écrit :
> 
> I tried this on windows and I couldn't even get it to play in the gpr or 
> executable directory (the base directory).  I tried with both firefox and IE.
> 
> On Fri, Sep 15, 2017 at 8:00 AM, Jeffrey R. Carter <jrcar...@acm.org> wrote:
> I have this tiny Gnoga app:
> 
> 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;
> 
> package body MP.UI is
>    Window : Gnoga.Gui.Window.Window_Type;
>    View   : Gnoga.Gui.View.View_Type;
>    Player : Gnoga.Gui.Element.Multimedia.Audio_Type;
>    Quit   : Gnoga.Gui.Element.Common.Button_Type;
> 
>    procedure Quit_Now (Object : in out Gnoga.Gui.Base.Base_Type'Class) is
>       -- Empty;
>    begin -- Quit_Now
>       Gnoga.Application.Singleton.End_Application;
>    exception -- Quit_Now
>    when E : others =>
>       Gnoga.Log (Message => "Quit_Now: " & 
> Ada.Exceptions.Exception_Information (E) );
>    end Quit_Now;
> begin -- MP.UI
>    Gnoga.Application.Title ("MP");
>    Gnoga.Application.HTML_On_Close ("MP ended.");
>    Gnoga.Application.Open_URL;
>    Gnoga.Application.Singleton.Initialize (Main_Window => Window);
>    View.Create (Parent => Window);
>    Player.Create (Parent => View, Source => "glass.ogg", Preload => True);
>    Gnoga.Log(Player.Media_Source);
>    View.New_Line;
>    Quit.Create (Parent => View, Content => "Quit");
>    Quit.On_Click_Handler (Handler => Quit_Now'Access);
>    Gnoga.Application.Singleton.Message_Loop;
> exception -- MP.UI
> when E : others =>
>    Gnoga.Log (Message => Ada.Exceptions.Exception_Information (E) );
> end MP.UI;
> 
> which works fine and reports the source as "http://127.0.0.1:8080/glass.ogg";.
> However, if I want to access a file not in the current directory, I have
> problems. Using "~/Code/Chattanooga/glass.ogg" results in the widget not being
> shown, and the source as "http://127.0.0.1:8080/~/Code/Chattanooga/glass.ogg";.
> "/home/jrcarter/Code/Chattanooga/glass.ogg" also results in the widget not 
> being
> shown and the source as
> "http://127.0.0.1:8080/home/jrcarter/Code/Chattanooga/glass.ogg";.
> "file:///home/jrcarter/Code/Chattanooga/glass.ogg" results in the widget being
> shown, but nothing plays, with the reported source also being
> "file:///home/jrcarter/Code/Chattanooga/glass.ogg".
> 
> The file exists:
> 
> $ ll /home/jrcarter/Code/Chattanooga/glass.ogg
> -rw-r--r-- 1 jrcarter jrcarter 18999 Jan 11  2015 
> /home/jrcarter/Code/Chattanooga/glass.ogg
> 
> How can I play a file not in the current directory?
> 
> --
> Jeff Carter
> ------------------------------------------------------------------------------
> 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


------------------------------------------------------------------------------
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