Video starts in background
#1
Hello all,

Building an addon here. It works, other than one problem: when my addon plays a video, it always starts in the background, with the menu overlaid.
The code that fires the video is:

xbmc.Player().play(item=video_item)

How can I get my videos to start in the foreground? (NOTE: This only happens with my addon, everything else plays as you would expect.)

Is this deprecated? Should I be playing the video through some other API call, or is there something I need to prep first? Thanks!
Reply
#2
it depends on the type of addon you're creating.
first scripts, the code you've posted should be ok.

on the other hand, if you're working on a plugin, then the code is incorrect.
should you need more info, there's a video plugin tutorial in our wiki:
https://kodi.wiki/view/HOW-TO:Video_addon
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
(2021-07-31, 21:17)ronie Wrote: it depends on the type of addon you're creating.
first scripts, the code you've posted should be ok.

on the other hand, if you're working on a plugin, then the code is incorrect.
should you need more info, there's a video plugin tutorial in our wiki:
https://kodi.wiki/view/HOW-TO:Video_addon

Thanks, you were right on the money. Changing my code to:

xbmcplugin.setResolvedUrl(__handle__, True, listitem=xbmc_playlist)

caused it to play correctly.
Reply
#4
(2021-07-31, 21:17)ronie Wrote: it depends on the type of addon you're creating.
first scripts, the code you've posted should be ok.

on the other hand, if you're working on a plugin, then the code is incorrect.
should you need more info, there's a video plugin tutorial in our wiki:
https://kodi.wiki/view/HOW-TO:Video_addon

Correction: ALMOST works. When I use:

xbmcplugin.setResolvedUrl(__handle__, True, listitem=xbmc_playlist)

I get the following error, even though the videos play correctly:

Error Contents: Incorrect type passed to "XBMCAddon::xbmcplugin:: setResolvedUrl", was expecting a "p.XBMCAddon::xbmcgui::ListItem" but received a "p.XBMCAddon::xbmc:: PlayList"

If I use:

xbmc.Player().play(xbmc_playlist)

I get no error, but video is back to playing in the background. There must be a solution...
Reply

Logout Mark Read Team Forum Stats Members Help
Video starts in background0