Kodi Community Forum
v17 Background Music in Kodi - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: v17 Background Music in Kodi (/showthread.php?tid=321449)



Background Music in Kodi - Ragu24 - 2017-09-13

Hi,

I recently built a HTPC and installed Kodi. Kodi is a great application which suits my needs as a media center. I need to play background music while I start Kodi and until I select a movie title the music should continue playing. After the movie selection, the music should stop and movie should play. After watching the movie the music should play again while browsing. All this should be done in the background. I am new to Kodi and I don't know how the scripts or plugins work. Can anyone tell me the method to do this. Thanks in advance.


RE: Background Music in Kodi - ronie - 2017-09-13

general addon dev info:
http://kodi.wiki/view/Add-on_development

service addon example:
http://kodi.wiki/view/Service_addons

kodi Player docs:
https://codedocs.xyz/xbmc/xbmc/group__python___player.html


RE: Background Music in Kodi - Ragu24 - 2017-09-13

Hi ronie,

Thanks for your reply. Previously I saw a thread where they were using Callbacks addon for this function. Can you explain on how to do this. I am new to writing scripts and programming. I am specifying the path below. I also asked in that thread itself but I got no reply. Can you help me with this. I really needed this feature. Thank you so much.

https://forum.kodi.tv/showthread.php?tid=171177


RE: Background Music in Kodi - ronie - 2017-09-15

the callbacks addon is in our repo, so just install it and check if it suits your need.

there's a support thread for the addon here:
https://forum.kodi.tv/showthread.php?tid=256170

and a manual there:
http://kodi.wiki/view/Add-on:Kodi_Callbacks


RE: Background Music in Kodi - Ragu24 - 2017-09-15

Hi,

Thanks for the manual. I will check this and revert back. Thanks once again.


RE: Background Music in Kodi - Ragu24 - 2017-09-18

Hi ronie,

I installed the callbacks addon and from kodi interface I found that I can run a script or python file at startup. The point is, I don't know how to write a script for playing background music. Do you have any script that you know that can make the job done.

Thanks in advance.


RE: Background Music in Kodi - ronie - 2017-09-20

perhaps you don't need to write a python script?

the callback addon allows you to execute built-in commands, so you could try a task like this:
Code:
PlayMedia(/path/to/your/playlist)

then create two events to run this task: onStartup / onPlayBackEnded


RE: Background Music in Kodi - Ragu24 - 2017-09-21

Thank you so much for the information. I thought it would be a huge process. This really helped me a lot.



Thank you once again.


RE: Background Music in Kodi - Ragu24 - 2017-09-23

Hi Ronnie,

If I wanted to play a playlist of songs randomly, what should I do ?


RE: Background Music in Kodi - Rijaelto - 2018-05-17

Hi Ragu24 and others that come here for the same thinq hahaha

Install the add-on callback (thank you guys, its awesome)

Create a notepad file with this:

import xbmc
xbmc.executebuiltin("PlayerControl(RandomOn)")
xbmc.executebuiltin("PlayMedia(
Code:
/path/to/your/playlist
)")

Save with the name backgroundmusic.py

Go to the add on settings, create a new python task and use the python file backgroundmusic.py, after this go to events and select the task with the events you wish.

Its all, enjoy.

Thank you