Best way for plugin to handle live streams? (Disable resume from / watched)
#1
Hi,

I have a few plugins that play live streams (video & audio) and I need a way of disabling KODI from trying to resume / marking as watched.
Resuming breaks many live streams.

As far as I can tell, there is no "mediatype" for live content?

What is the best way to tackle this in the addon?
Maybe set the list item to a folder instead of setting as playable?
And then use xbmc.play?

Thanks,

Matt
Reply
#2
(2017-12-04, 21:51)matthuisman Wrote: And then use xbmc.play?

Yes, but set isFolder=False and don't touch isPlayable.
Reply
#3
@Roman_V_M

Thank you,

so, I have updated my play function to below

python:
    def play(self, data):
        li = self._create_list_item(data)
        xbmc.Player().play(li.getPath(), li)
        #xbmcplugin.setResolvedUrl(self._handle, True, li)

Seems to work fine Big Grin
Can you confirm I don't need to do any setResolvedUrl?
Reply
#4
(2017-12-05, 03:30)matthuisman Wrote: @Roman_V_M

Thank you,

so, I have updated my play function to below

python:
    def play(self, data):
        li = self._create_list_item(data)
        xbmc.Player().play(data.get('url'), li)
        #xbmcplugin.setResolvedUrl(self._handle, True, li)

Seems to work fine Big Grin
Would be nice if I could get the path from the listitem (eg. li.path or li.getpath()) - but no biggy.

Can you confirm I don't need to do any setResolvedUrl?
You should use setResolvedUrl.
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#5
(2017-12-05, 03:35)Lunatixz Wrote:
(2017-12-05, 03:30)matthuisman Wrote: @Roman_V_M

Thank you,

so, I have updated my play function to below

python:
    def play(self, data):
        li = self._create_list_item(data)
        xbmc.Player().play(data.get('url'), li)
        #xbmcplugin.setResolvedUrl(self._handle, True, li)

Seems to work fine Big Grin
Would be nice if I could get the path from the listitem (eg. li.path or li.getpath()) - but no biggy.

Can you confirm I don't need to do any setResolvedUrl?
You should use setResolvedUrl.   
After the xbmc.Player()?
I tried that and it causes a play loop.
Without the setResolvedUrl, everything seems fine?

Update:
If I set it to playable and then do the play followed by the setResolvedUrl - it works.

python:
        if data.get('isLive', False):
            xbmc.Player().play(li.getPath(), li)
        xbmcplugin.setResolvedUrl(self._handle, True, li)
Reply
#6
(2017-12-05, 03:42)matthuisman Wrote:
(2017-12-05, 03:35)Lunatixz Wrote:
(2017-12-05, 03:30)matthuisman Wrote: @Roman_V_M

Thank you,

so, I have updated my play function to below

python:
    def play(self, data):
        li = self._create_list_item(data)
        xbmc.Player().play(data.get('url'), li)
        #xbmcplugin.setResolvedUrl(self._handle, True, li)

Seems to work fine Big Grin
Would be nice if I could get the path from the listitem (eg. li.path or li.getpath()) - but no biggy.

Can you confirm I don't need to do any setResolvedUrl?
You should use setResolvedUrl.   
After the xbmc.Player()?
I tried that and it causes a play loop.
Without the setResolvedUrl, everything seems fine? 
You don't use xbmc.player()... just setResolvedUrl
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#7
(2017-12-05, 04:04)Lunatixz Wrote:
(2017-12-05, 03:42)matthuisman Wrote:
(2017-12-05, 03:35)Lunatixz Wrote: You should use setResolvedUrl.   
After the xbmc.Player()?
I tried that and it causes a play loop.
Without the setResolvedUrl, everything seems fine?  
You don't use xbmc.player()... just setResolvedUrl 
yes, I originally had that.
But how do I stop it trying to resume??
That is the reason for this thread.
Reply
#8
(2017-12-05, 03:35)Lunatixz Wrote: You should use setResolvedUrl. 
 Only if you need proper watched/in progress status handling which the original poster does not. setResolvedUrl simply doesn't fit into all possible scenarios.
Reply
#9
xbmc.Player().play(li.getPath(), li)

has the downside of not showing anything if the stream actually fails.
It also doesn't show "play" in the context menu as the list item is marked as not playable.

It also seems less responsive as KODI doesn't show the spinner straight away.

Hmmm.

Might just go back to playable=True
There really needs to be some sort of mediatype: 'livevideo' or something that disables all the watched / resume from stuff

OK, after hunting around in the source code I spotted this:
https://github.com/xbmc/xbmc/blob/aa2666...ob.cpp#L94

KODI won't try save the state if !item.IsLiveTV()
https://github.com/xbmc/xbmc/blob/c6dbd0....cpp#L1009

So, if the URL ends with .pvr it should consider it liveTV and not save the state.
I simply added .pvr to the end of my plugin://  play URLS and seems to work  Blush
Reply
#10
does it only check last 4 characters or acutally look for extension ?
will
Quote:http://server/dir/path/file.mkv?id=1&pvr=.pvr
Will act as LiveTV or File?
Reply
#11
Just last 4x characters need to be ".pvr"

It still acts the same as a normal playable video except
1) Context has a item "Switch Channel"
2) It won't remember watched state
3) It won't try to resume
Reply
#12
sure, maybe it overwriten like the example with 'plot' being populated ignores 'isPlayable'? because I have populate every video properties, set typ as 'video' added ?.pvr at the end of url


python:

liz.setProperty('path', 'http://127.0.0.1/myfiles.mkv?livetv=.pvr')

And my ListItems still don't have `Switch Channel`

Edit: funny enough setProperty('path', '') don't really set path for that items.
you need explicit call setPath(''), but sadly that did not help here.
Reply

Logout Mark Read Team Forum Stats Members Help
Best way for plugin to handle live streams? (Disable resume from / watched)0