Kodi Community Forum
create addon that just play an .m3u8 link - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+--- Thread: create addon that just play an .m3u8 link (/showthread.php?tid=373071)



create addon that just play an .m3u8 link - hunadamka - 2023-05-09

Hi, 
I would like to make a simple kodi addon that just plays a simple .m3u8 link, there is no problem with the installation, but when I start the addon it does nothing and the error is not logged

does anyone have any idea what I'm doing wrong?
thanks in advance!

python:
#addon.xml file
<addon id="plugin.video.play_test" name="play_test" version="0.0.1" provider-name="asd">
    <extension point="xbmc.python.pluginsource" library="main.py"></extension>
</addon>

#main.py file
import xbmcaddon
import xbmcgui
import xbmcplugin
import urllib.parse
import sys

addon = xbmcaddon.Addon()

def play_video(url):
    xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=True, listitem=xbmcgui.ListItem(path=url))

params = {'url': 'https://....m3u8_link'}

video = {'title': 'Test Video', 'url': params['url']}

url = sys.argv[0] + '?action=play&title=' + urllib.parse.quote(video['title']) + '&url=' + urllib.parse.quote(video['url'])

play_video(video['url'])



RE: create addon that just play an .m3u8 link - MiamiBlues - 2023-05-09

Check your tags, you are closing right after defining the addon.


RE: create addon that just play an .m3u8 link - jbinkley60 - 2023-05-09

(2023-05-09, 11:17)hunadamka Wrote: I would like to make a simple kodi addon that just plays a simple .m3u8 link, there is no problem with the installation, but when I start the addon it does nothing and the error is not logged

does anyone have any idea what I'm doing wrong?
thanks in advance!

Can you post the logs for when you run the addon ?  This will allow us to see if the player is starting and whether it is getting an error .


Thanks,

jeff


RE: create addon that just play an .m3u8 link - scott967 - 2023-05-10

Not sure you're playing anything?  Is there more code than this that adds the listitem to a directory?

Not any expert but I would think you need something like:
python:
def play_video(url):
    liz = xbmcgui.ListItem(path=url)
    xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=True, listitem=liz)
    xbmc.Player().play(liz.getPath())

scott s.
.


RE: create addon that just play an .m3u8 link - Naveena - 2023-09-29

Hi hunadamka, here is the smaple code 

<?xml version="1.0" encoding="UTF-8"?>
<addon id="my_addon" name="My Addon" version="1.0" provider-name="Your Name">
  <extension point="xbmc.addon.metadata">
    <summary>My Addon</summary>
    <description>This is a simple Kodi addon that plays a single .m3u8 link.</description>
  </extension point>
  <extension point="xbmc.addon.video">
    <video>
      <default>
        <file>MyVideo.py</file>
      </default>
    </video>
  </extension point>
</addon>