Kodi Community Forum

Full Version: Is it possible to start an addon from m3u file?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello.

I wrote myself a small addon to solve a problem that is specific to my needs. the addon simply receives a video URL (from my HTTP server) and then plays it using the xbmc.Player class like this:
python:

url = getVideoPath(videoName) # http://my_server_address/video.mp4
player = MyPlayer()
player.play(url)
while self.isPlaying():
    xbmc.sleep(100)

what I want to do is to pass the name of a video file to this addon using .STRM files currently my file looks like this:

python:

plugin://plugin.video.myAddonName/?action=play&filename=video.mp4

this does in fact work and the playback starts but there is an error before the video starts playing which says "can't find a next item to play" which I want to get rid of.

lastly and before anyone says it no, I can't place the URL directly into the .STRM file since the server requires authentication and an API request in order to give the URL to the requested video file

debug log link
Thread moved to addon development
A plugin is not a script. Player invocation is not corrdct. Behave like a plugin, ie, you return the real url using setResolvedUrl.
(2020-09-26, 11:37)spiff Wrote: [ -> ]A plugin is not a script. Player invocation is not corrdct. Behave like a plugin, ie, you return the real url using setResolvedUrl.

could you elaborate on your answer? what do you mean by "Player invocation is not correct"? how should I invoke the player?

Edit1: also I should say that I need the custom player since I'm using the onPlayBackStarted/onPlayBackStopped to do a clean teardown.
A plugin is a virtual filesystem entry. It has a limited set of expected behaviors. It can return a list of files, or it can return a final resolved url for playback. See any of the hundreds of available plugins for the semantics of this. In particular plugins are not resident. If you need to monitor playback, you either have to implement it as a script, or you have to split out the resident part into a service.