I am currently developing a channel plugin and having an issue with playing video.
In my case, I am getting the following JSON response from the server when I load season specific data.
{
"id": "1",
"name": "abc",
"poster_small": "http://hostname/image.jpg",
"description": "ABC Description",
"playlist": [
{
"name": "episode 1",
"link:": "http://hostname/episode-1-DivX.mp4"
}
]
}
To display video I am using the following code...
@route(PREFIX + "/watch_season")
def WatchSeason(id):
# setup the search request url
values = {'key': API_KEY, 'command': 'getSeason', 'season_id': id}
request = HTTP.Request(API_URL, values=values, cacheTime=CACHE_1DAY)
response = json.loads(request.content)
oc = ObjectContainer()
playlist = response.get('playlist')
for video in playlist:
video_name = video.get('name')
video_link = video.get('link')
oc.add(
VideoClipObject(
url=video_link,
title=video_name,
summary=response.get('description'),
thumb=response.get('poster_small'),
items=[
MediaObject(
optimized_for_streaming=True,
audio_codec=AudioCodec.AAC,
video_codec=VideoCodec.H264,
container=Container.MP4,
parts=[PartObject(key=Callback(PlayVideoIndirect, url=video_link))]
)
]
)
)
return oc
@indirect
def PlayVideoIndirect(url):
return IndirectResponse(VideoClipObject, key=url)
Any ideas how I can play the video?
PS. I tried to set video_codec='divx' - doesn't work.