Run additional code when clicking on ListItem
#1
Hi

I'm creating my own XBMC video plugin.
I have created and display channel list using xbmcgui.ListItem and xbmcpluign.addDirectoryItem functions to display available channels.
I get channels list using HTTP get and parse JSON table.

My problem is that when I create list with channels and fill URL parameter I should also add token to the end of URL string.
This token is valid only for 5 minutes after I get it.

So when I create list and user will not get new token.

So my question is, if it's possible to add some action when user click on item list to start video?

For example, my list of channels and URLs
Channel1 URL=rtmpConfusederver1.com/vod/channel1
Channel2 URL=rtmpConfusederver1.com/vod/channel2
Channel3 URL=rtmpConfusederver1.com/vod/channel3


Now I would like to add string &token=1234567890 to the end of URL string but this should happend after user click on ie Channel1
So, it should works like this:

1) User run plugin, list items are populated as aboce
2) User click on Channel1
3) some function is called that receive token numer.
4) token is concated to the URL, like rtmpConfusederver1.com/vod/channel1&token=1234567890
5) Video starts
6) User stop video, and go back to the item list
7) User click on Channel2
8) again some function is called that receive token numer.
9) token is concated to the URL, like rtmpConfusederver1.com/vod/channel1&token=0987654321

So, token is taken every time when user click on List Item but before video starts

I hope you will understand what I meant :-)
Reply
#2
Actually, its' better to avoid using direct URLs in ListItems.
Best practice is to get/create a playable URL just before playing and then to pass it to Kodi player via xbmcplugin.setResolvedUrl().
Reply

Logout Mark Read Team Forum Stats Members Help
Run additional code when clicking on ListItem0