Retrieve Dailymotion Games chat messages - chat

I would like to retrieve Dailymotion Games chat messages using their API, but the official documentation is not very clear on this point => https://faq.dailymotion.com/hc/en-us/articles/203886473-Dailymotion-live-API-for-developers
I tried to use the API to retrieve comments of a video with my live video id (endpoint => https://api.dailymotion.com/video/[LIVE_VIDEO_ID]/comments), but it doesn't return any chat messages...
Do you know if it's possible?

Ok, I've searched a little bit more and I found a more elegant way to do that avoiding the scraping method.
In fact the embed chat page (returned by the chat_embed_url) use EventSource to get notified when a new message arrived.
With this good NPM package, I've been able to retrieve chat messages in only 5 lines:
var EventSource = require('eventsource');
var url = 'http://dmchat.dailymotion.com/rooms/[USERNAME]-[CHANNEL_ID]';
var es = new EventSource(url);
es.addEventListener('message', function (e) {
console.log(e.data);
});

A comment on a video is different from the chat feature, this is why chat messages don't appear in comments.
You can't get individual chat messages so far, but you can get the chat embed code on two different ways:
using the Dailymotion API, you can request the chat_embed_html or chat_embed_url fields on the video object
or you can get it directly from the video pages on dailymotion games, by clicking on the settings icon below the chat, and click "copy embed code"

Related

Facebook Messenger Sender Actions

I am trying to use Sender Actions as described in the messenger Send API docs. However when I send a typing_on POST I do no see anything happen in messenger. I have tried on chrome desktop and the messenger android app.
I am able to send a mark_seen POST and this does update the chat with an icon indicating my message has been seen.
The request body looks as follows:-
{
"recipient":{
"id":"<PSID>"
},
"sender_action":"typing_on"
}
When sending mark_seen, typing_on or typing_off I always get the following response body.
{
"recipient_id": "<PSID>"
}
Are there additional steps needed to get the typing indicator to display? Does it only work on a specific platform? I cannot find any more documentation, and I am not getting any error messages, the POST status comes back OK identically when sending mark_seen or typing_on, I just can't see any effect after typing_on.
Okay I got reply from Facebook developer team on Facebook Developers group
Quote:
"This changed recently for mobile and is currently assigned to an internal team". Looks like something internal.

Jive - Get current blog post from app

I'm developing an app which has a Content Action and an !app Action.
I would like to get via javascript (i.e. Open Social API I suposse...) the current user (I got it!) and the current blog post (blogpost id) from both actions.
Is it possible?
Thank you!
I found it!
You can do it adding an gadgets.util.registerOnLoadHandler() listener, and inside it you should call the osapi.jive.core.container.getLaunchContext(function (selection) {});
From selection object you can get the type and the id:
var type = selection.jive.content.type;
var contentid = selection.jive.content.id
You have a full example from Jive Developers Website

Red5 video chat tutorial AS3

Where can I find working examples of a video chat application based on AS3 and Red5?
I'm having trouble to understand how to attach a user stream to another user and vice-versa. Can someone point to a simple example or provider some sample code?
Here is a link to a SimpleChat demo project from Red5: http://www.red5.org/downloads/simpledemos/
Anyway just to give you a basic concept:
Assuming that you have a chat application, you will have a single ID for each user, right? So lets suppose a scenario where user A start streaming the mic/cam to user B:
//start streaming the mic and camera
nsPub = new NetStream ( netConnection );
nsPub.attachAudio(Microphone.getMicrophone());
nsPub.attachCamera(Camera.getCamera());
nsPub.publish('A');
//need to send a command to user B to notify him that user A started streaming,
//this command can be sent by a SharedObject or invoking a remote method, that will
//invoke a client method in B
//code to receive the mic/cam streaming from user A
nsCli = new NetStream ( netConnection );
videoCompoment.attachNetStream( nsCli );
nsCli.play('A');

Creating a docked music player for SoundCloud and mp3s

I'm trying to create a website that pulls free songs from multiple sources and lets users play them by clicking on their cover art, and launching them in a docked music player on the bottom of the page. Soundcloud's api offers me a lot of songs, but they are in a streaming api format, not in mp3 form.
The music players that SoundCloud offers are great for these streaming songs, but it won't work with the mp3s I'm pulling from other sites. Mp3 players like Jplayer are great for the mp3s, but I can't figure out how to get it to work with the streaming soundcloud format.
Think of a site like ex.fm: http://ex.fm/search/bob%20dylan
They pull their audio tracks from many sources but it is all playable through their one player.
Any help with this would be great.
Thanks
Check SoundCloud API
http://developers.soundcloud.com/docs/api/reference#tracks
There is a stream_url property for every track that's streamable outside of SoundCloud.
You need to register your app on Soundcloud and get API Key. With that key you can stream the tracks in your own player.
Edit, thanks to gryzzly. Example of SoundCloud API used with jPlayer:
var SOUNDCLOUD_API = 'http://api.soundcloud.com',
CLIENT_ID = '?client_id=REPLACE_WITH_YOUR_CLIENT_ID';
$(document).ready(function() {
var apiRequest;
$.get(SOUNDCLOUD_API + '/tracks/6981096.json' + CLIENT_ID)
.done(handleRepsonse);
function handleResponse (soundData) {
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
// stream_url is good enough for jPlayer,
mp3: soundData.stream_url + CLIENT_ID
});
},
swfPath: "http://www.jplayer.org/2.1.0/js"
});
}
});
And you can check it live at jsbin.com/ajaken/4/edit

Access Facebook albums from a flash app

I want to create a flash Facebook application in which, after pressing a button, the user will be able to browse his/her photo albums and choose a photo. How should i do that? What will be the code under the button to gain authentication from any user using this application?
Thanks.
I am currently writing a facebook application for a university assignment that will allow the user to do everything you can do in facebook, but via the flash player window. You will need a few basic things happening in order to do it.
User log in and authentication - this must be done via Facebook - using OAuth authentication, and meeting all of facebook's security policies
register the application with facebook
Use the Graph API (facebook's developer's toolkit) to get the necessary functions that will communicate with facebook via flash.
In Flash itself you will use a bunch of URLRequest functions to send out to FB for information, then you will need to retrieve that data responses and store them to variables (extracting data with a few lines of code is easy, something like this;
//initialise variables
public var photoURL:String;
var Request:URLRequest = new URLRequest("http://www.whatever the url for the graph api service you are using which is founf from FB");
//that ^^ will send off a request for the url, you then want to use the returned data by registering an event handler like this below
functionName.addEventListener(onComplete, completeHandler);
functionName(event, EVENT)
{
var loader:URLLoader = new URLLoader(Request);
var data:XML = new XMLData(load.loader); //i think this is right but not 100% sure, fiddle with it
//then you want to extract the data that is returned, for example, extracting xml data from a rest request works by hitting data from the xml by specifying a path to the object you want. an example of xml is this <rsp stat="ok"><photos ......more code="morecode"><photo url="url of photo"></photo</photos> so you can hit the url in that example like this;
photoURL = data.photos.photo.#url; //this line will grab the photo url for you, allowing you to dynamically create an array and assign photos to the flash stage according to the url you get
}
this is fairly advanced stuff and I am assuming that you have some decent knowledge on AS3, XML, and the FB API, if you need more help just reply