Why Doesn't My Kodi Plugin Play Videos? Problem with xbmcplugin.setResolvedUrl - 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: Why Doesn't My Kodi Plugin Play Videos? Problem with xbmcplugin.setResolvedUrl (/showthread.php?tid=377849) |
Why Doesn't My Kodi Plugin Play Videos? Problem with xbmcplugin.setResolvedUrl - kraldavi - 2024-06-08 I'm trying to create a simple Kodi plugin that plays a local video file. The code below is a simplified version of a larger project where I'm trying to play m3u8 streams. This code doesn't work and I can't figure out why. The logs don't contain any errors, but the video doesn't play. Can you please help me identify the problem? Here is my code:
Thanks for any advice! What did you try and what were you expecting? I followed the basic steps to set up a Kodi plugin and wrote a function to play a local video file. Specifically, I: Initialized the addon and retrieved its path using xbmcaddon.Addon(). Constructed the path to the local video file. Created a ListItem with the video path. Used xbmcplugin.setResolvedUrl to attempt to play the video. I expected the local video file video168.ts to start playing when the plugin was executed. Instead, the video doesn't play, and there are no errors in the Kodi logs that explain why. RE: Why Doesn't My Kodi Plugin Play Videos? Problem with xbmcplugin.setResolvedUrl - dickfitzwell - 2024-06-21 the list item needs the property "isPlayable" set to "true" along with "setResolvedUrl". I've only ever done it from a directory of list items though, so idk if the way you are coding it makes a diff. Code: list_item = xbmcgui.ListItem(path=video_path) RE: Why Doesn't My Kodi Plugin Play Videos? Problem with xbmcplugin.setResolvedUrl - Lunatixz - 2024-06-21 (2024-06-21, 14:33)dickfitzwell Wrote: the list item needs the property "isPlayable" set to "true" along with "setResolvedUrl". I've only ever done it from a directory of list items though, so idk if the way you are coding it makes a diff.+1 RE: Why Doesn't My Kodi Plugin Play Videos? Problem with xbmcplugin.setResolvedUrl - doko-desuka - 2024-09-14 I think the problem is your plugin flow. As soon as you invoke (enter) your video plugin, Kodi expects it to generate a directory of ListItem's with either xbmcplugin.addDirectoryItem() or xbmcplugin.addDirectoryItems() and xbmcplugin.endOfDirectory() .It does not expect to play any video right then. If you want to force Kodi to play something as soon as you enter your video plugin, you can't use setResolvedUrl() but rather xbmc.Player().play(...) in this way: Edit: when playback ends, Kodi might reload your plugin and that'd cause it to play the item again. What you're trying to do is unorthodox after all -- the best way is to have your plugin generate a single playable item in a directory, and then you navigate to it with the remote and play that item. PS setResolvedUrl() is for when the mediaPath points back to your own plugin because you don't yet know the direct link to the video file, like when the direct link to the video file needs to be fetched or resolved in some way, so mediaPath in this case can be something like "plugin://plugin.video.myvideoplugin/?param1=asfd¶m2=666" , which will cause Kodi to prepare playback and call your plugin again, and inside your Python code you use those URL parameters to find the direct link to the video file, and call setResolvedUrl() to give Kodi the direct link. This is all very useful when you don't yet know the direct link to the video file (like from a service that generates a timestamped filename, or requires login etc).
|