Auto play a video on startup
#1
Hi,

I tried searching but couldn't find anything.

I have a streaming video file that plays a live web channel. I'd like to have it autoplay when XBMC starts without having to manually select and play the video.

How can I accomplish that?

Running Confluence on Win 7.

Thanks.
Reply
#2
You need to create a file called autoexec.py in the folder %appdata%\xbmc\userdata (appdata is an environment variable containing something like C:\Users\<username>\AppData\Roaming) and in this file put:

Code:
import xbmc

xbmc.executebuiltin("PlayMedia(C:\\somepath\\somefile.strm)")

When you start XBMC it will execute autoexec.py and the above code will attempt to open C:\somepath\somefile.strm just as if you had opened manually in XBMC.

If it doesn't work enable debug logging and hopefully xbmc.log will contain a helpful error message. Note that in Pythion code \ is an escape character so you need to use \\ where you want a single \ in the file name. You might be able to put the URL in directly, though I haven't tried it.

JR
Reply
#3
This works a treat for me. I have used this to autostart a video on XBMC.

In my case it autoplays on boot from the raspberry pi, using OpenELEC.

For me the video file to autoplay was on an attached usb dongle. I checked the address using the built in file manager, which was
/var/media/KINGSTON/Horizon.m4v

This then translated to an autoexec.py containing the following text

Code:
import xbmc
xbmc.executebuiltin("PlayMedia(\\var\\media\\KINGSTON\\Horizon.m4v)")

This was saved into the OPENELEC > Userdata folder using Finder from my mac over the network.

It can also be transferred to the device using the same usb dongle, then using the built in file manager to copy the file to the Profile Directory.

I also needed one further tweak. By defauly XBMC would ask whether to start from beginning or resume the video file at previous point. I therefore made an advancedsettings.xml file which told it to ignore resume within a number of settings (i chose 36000 seconds, or 10 hours). This file sits in the same directory as the autoexec.py above. OPENELEC > Userdata.

Here is the advancedsettings.xml file:
Code:
<advancedsettings>
<video>
<ignoresecondsatstart>36000</ignoresecondsatstart>
</video>
</advancedsettings>

Finally, I had to remove the bookmark for the file, which is one of the options during playback. With the bookmark removed the file autoplays on booting the device.

I think this could be a great Kiosk style application...
Reply



Logout Mark Read Team Forum Stats Members Help
Auto play a video on startup0
This forum uses Lukasz Tkacz MyBB addons.