Background music in a loop on a specific window
#1
Hi all,

I am trying to create a window, which, when opens, will play a specific file - preferably in a loop. Sort of like background music...

I tried to do the following:

xml:
<onclick>PlayMedia(~Desktop/file.mp3</onclick>
<onclick>ActivateWindow(1110)</onclick> <!-- this is a my custom window -->

However - I get an error:

Code:
16:18:58.228 T:140735956284352   ERROR: CAudioDecoder: Unable to Init Codec while loading file sounds/file.mp3
16:18:58.228 T:140735956284352 WARNING: PAPlayer::QueueNextFileEx - Failed to create the decoder
16:18:58.229 T:140735956284352   ERROR: PlayMedia could not play media: sounds/file.mp3
16:18:58.821 T:140735956284352   ERROR: Init: Error opening file sounds/file.mp3

The file definitely exists - in skin/media/sounds/file.mp3. I also tried it in skin/sounds/file.mp3 but no luck.

Also, the above would not stop the music when I exit the window - can I use something like <onfocus> ?

Thanks
CJ
Reply
#2
- move the playback to custom window/dialog
as an <onload>PlayMedia(special://skin/media/sounds/file.mp3/)
<onunload>stop</onunload>
Skins |  Titan M O D   •   S W A N (WIP)
Reply
#3
Ah excellent! That works!

Now I am trying to make it repeat (preferably gaplessly). I tried adding this:

<onload>PlayerControl(repeat)</onload>

...but it doesn't repeat. I read that only playlists are repeatable and not individual tracks, so I tried passing path to the playlist but getting this error.

ERROR: PlayMedia could not play media: special://skin/media/sounds/pl.m3u

Inside the m3u file is:

#EXTM3U
special://skin/media/sounds/file.mp3

Any ideas on this?
Reply
#4
There an action command

PlayerControl(RepeatAll)

Try to set it also onlosd after the play command

(maybe an delay is needed, but test first)
Skins |  Titan M O D   •   S W A N (WIP)
Reply
#5
Thanks. The PlayerControl is after the Play command - RepeatAll doesn't seem to do anything.
Reply
#6
Can't seem to edit my own posts... How can I delay the PlayerControl after Play?
Reply
#7
Your account is still too new for full account privileges. Smile
My Signature
Links to : Official:Forum rules (wiki) | Official:Forum rules/Banned add-ons (wiki) | Debug Log (wiki)
Links to : HOW-TO:Create Music Library (wiki) | HOW-TO:Create_Video_Library (wiki)  ||  Artwork (wiki) | Basic controls (wiki) | Import-export library (wiki) | Movie sets (wiki) | Movie universe (wiki) | NFO files (wiki) | Quick start guide (wiki)
Reply
#8
Try

xml:

<onload>AlarmClock(playmeinloop,PlayMedia(special://skin/media/sounds/file.mp3/),**use the length of your file in seconds here**,silent,loop)</onunload> <!-- add after 1st onload play command force playback in loop at the time expiration -->

<onunload>CancelAlarm(playmeinloop,true)</onunload> <!-- put after stop onunload, cancel loop on exit -->



Source
Skins |  Titan M O D   •   S W A N (WIP)
Reply
#9
Thank you! That's perfect - it works Smile Just need to make sure my loop is exactly n seconds long so there are no perceptible gaps.
Reply
#10
I am going to ask another question... Say after 19 seconds, I would like to automatically play a particular file. In my case, it would be a selected file from the list... It would display my custom window (sort of intro, if you like) and then automatically play. Is that possible and how?

I know that play button has an ID of 8 but what's the equivalent action?
Reply

Logout Mark Read Team Forum Stats Members Help
Background music in a loop on a specific window1