playing a video after retrieving metadata url
Added by Anthony Dahanne almost 8 years ago
Hello plugin developers !
I have a question regarding the plugin JS API : how can I request an url before playing a video ?
Look at this snippet taken from tou.tv plugin :
plugin.addURI(PLUGIN_PREFIX+"emission:(.*):(.*)", function(page,emissionId,title) {
page.type = "directory";
page.metadata.title = title;
var getEpisodesResponse = showtime.httpGet(EPISODES_URL + emissionId);
var episodes = showtime.JSONDecode(getEpisodesResponse);
for each (var episode in episodes.d) {
var getEpisodeResponse = showtime.httpGet(EPISODE_VALIDATION_URL + episode.PID + JSON_OUTPUT);
var episodeMetadata = showtime.JSONDecode(getEpisodeResponse);
var metadata = {
//metatadata stuff
};
page.appendItem(HLS_PREFIX+episodeMetadata.url, "video", metadata);
}
in this code, I first got the list of episodes, and then for each episode, I get the url of the episode.
So when there is a list of 40 episodes, I make 1+ 40 http requests; even if the user just wants to play 1 episode.
That would be ok, but the episodeMetadata.url returned is only valid for 1 mn or 2; so I would like to get the episode metadata just when the user clicks on the video link.
Do I have to create a pass through page that would just get the metadata of the selected episode and then play the video ? how can I do that ? what would be the type of this pass through page ? directory ? item ? and from this how can I tell showtime to play the video ?
thanks for your answers, I hope I was clear enough !
Anthony
Replies (2)
RE: playing a video after retrieving metadata url
-
Added by Andreas Smas almost 8 years ago
Yes this is certainly possible.
I took the time to write a wiki page about it.
Please see JSAPI_play_video
RE: playing a video after retrieving metadata url
-
Added by Anthony Dahanne almost 8 years ago
Thanks again Andreas !
This is the info I was looking for !
Anthony
(1-2/2)