2021-04-05, 23:22
Hi there,
I'm trying to create own addon with my local server movies different qualities. I have created all local server API endpoints. everything seems to be working fine. but I have an issue with ResumeTime when I use custom player (xbmc.player().play()) instead of `xbmcplugin.setResolvedUrl`
This is why I need to use directory item (isFolder=true) and custom player instead of xbmcplugin.setResolvedUrl. My first request will list all movies and when I click on the movie, it will do another request to local server and get available qualities of that specific movie. I wouldn't know how many qualities available when I requesting the movie list and I need to auto play if there's only one quality available. If there are more qualities available, then list them as a movie item again.
This is the part not working for me. When I user xbmc.player().play(), I cannot get ResumeTime work. anyone have any idea how I can get this ResumeTime work
I'm trying to create own addon with my local server movies different qualities. I have created all local server API endpoints. everything seems to be working fine. but I have an issue with ResumeTime when I use custom player (xbmc.player().play()) instead of `xbmcplugin.setResolvedUrl`
This is why I need to use directory item (isFolder=true) and custom player instead of xbmcplugin.setResolvedUrl. My first request will list all movies and when I click on the movie, it will do another request to local server and get available qualities of that specific movie. I wouldn't know how many qualities available when I requesting the movie list and I need to auto play if there's only one quality available. If there are more qualities available, then list them as a movie item again.
This is the part not working for me. When I user xbmc.player().play(), I cannot get ResumeTime work. anyone have any idea how I can get this ResumeTime work
python:
import sys, xbmc, xbmcgui, xbmcplugin
STREAM_URL = 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4'
def run(addon_url):
# Play video
if addon_url.endswith('/play'):
# Only able to check the directory contents at this point (whether play video or display directories)
listitem = xbmcgui.ListItem(path=STREAM_URL)
listitem.setInfo('video', {})
listitem.setProperty('IsPlayable', 'true')
listitem.setProperty('ResumeTime', str(120))
listitem.setProperty('TotalTime', str(300))
# Kodi Player to stop script. hack to play video from directory item
xbmcplugin.setResolvedUrl(int(sys.argv[1]), succeeded=False, listitem=listitem)
xbmc.Player().play(STREAM_URL, listitem )
# Setup menu item
else:
xbmcplugin.setContent(int(sys.argv[1]), 'videos')
listitem = xbmcgui.ListItem(label='video mp4')
listitem.setInfo('video', {})
listitem.setProperty('IsPlayable', 'true')
url = addon_url + '/play?mode=test2'
xbmcplugin.addDirectoryItem(int(sys.argv[1]), url, listitem, isFolder=True)
xbmcplugin.endOfDirectory(int(sys.argv[1]))
run(sys.argv[0])