I am developing a sort of Stream HUB (personnal project) and I would like to know if is there a way to know the on/off status from a Dailymotion Live.
I managed to get the status from a Twitch stream pretty easily with jQuery, and a json request
(for people who are looking for a way) (credits : Twitch live status of each username on the page)
$.getJSON("http://ift.tt/1eP7a4l"+strStream+".json?callback=?",function() {
}).done(function(data) {
if (data.stream == null) {
// Stream is off
} else {
// Stream is on
}
});
But I have no idea how to make it work for Dailymotion streams. I couldn't reach any real documentation about Dailymotion API with streamings (only normal vid). (http://ift.tt/1B0yoyp) And I could not find anything about on Stackoverflow. (Maybe I used the wrong keywords)
I would prefer to use a javascript/json function, but i accept any answer !
UPDATE 1
Ok so I found a solution working perfectly, and using the same techniques as the Twitch method, so here is the solution:
$.getJSON( "http://ift.tt/17oxNe2"+s.video+"?fields=onair" , function (data) {
var live = data.onair;
if (live==true){
// Stream is on
} else {
// Stream is off
}
updateStreamLabel(s);
});
(Credits, in french : http://ift.tt/1pJo7lX, you also have an exemple of how to do it in php) !
(Sorry for english mistakes!)
Aucun commentaire:
Enregistrer un commentaire