[Gambas-user] Music.Length part 2

Patrik Karlsson pata.karlsson at ...626...
Wed May 28 14:32:19 CEST 2014


2014-04-23 17:51 GMT+02:00 Benoît Minisini <gambas at ...1...>:

> Le 23/04/2014 17:38, Patrik Karlsson a écrit :
> > Hi,
> >
> > it's almost 6 years since I wrote the first post [1] regarding
> Music.Length
> > I recently picked up Gambas again and I am about to finish this little
> > project now. :)
> >
> > As far as I can tell, there is still no easy "Gambas way" to get the
> length
> > of an audio file, right?
> >
> > Would it be possible to implement such a function now?
> > It would be really nice to have Music.Play return the length in seconds
> as
> > float and a pure Music.Length function.
> >
> > In the previous thread I got some answers regarding command line tools,
> but
> > in this case my audio files are bundled in the project.
> >
> > /patrik
> >
> > [1]
> >
> http://sourceforge.net/p/gambas/mailman/gambas-user/thread/577069a50806200210i701ff536pf4e655c4cfc45ff9%40mail.gmail.com/#msg19733859
>
> You should use the gb.media component instead. Look at the "MediaPlayer"
> example, it displays the length of the video/audio file it plays.
>
> I admit that playing a file to know its length is a bit stupid. It
> should be possible to create a GStreamer pipe to just know the length of
> a multimedia file without playing it.
>
> --
> Benoît Minisini
>
>
I had some trouble with gambas gstreamer on Elementary OS so now I'm on
Kubuntu.

I get MediaPlayer to play a mp3 file as long as it is located _outside_ my
gambas project:
  $hPlayer.URL = Media.URL("internal.mp3") ' does not play
  $hPlayer.URL = Media.URL("/home/patrik/external.mp3") 'plays

What I really do need is to play, get the duration an position for a file
bundled _inside_ my gambas project.
Is MediaPlayer capable of doing that?

If not, can MediaPlayer play a file in my gambas executable archive with
something like:
  $hPlayer.URL = Media.URL("/home/patrik/app.gambas#internal.mp3") ?

/Patrik



More information about the User mailing list