I'm trying to playback a live video that is streamed using the Facebook app. When I hit the /me/live_videos endpoint in the Graph API Explorer, I can see my stream:
{
"status": "LIVE",
"stream_url": "rtmps://rtmp.facebook.com:443/rtmp/1659765194096063?ds=1&s_efg=eyJxZV9ncm91cHMiOnsiZmJsaXZlX3NlcnZlcl9leHBlcmltZW50Ijp7InNlcnZpY2VfcG9ydCI6IjE3MDAwIn19fQ%3D%3D&a=ATiAO7IBgkxJpDTS",
"secure_stream_url": "rtmps://rtmp.facebook.com:443/rtmp/1659765194096063?ds=1&s_efg=eyJxZV9ncm91cHMiOnsiZmJsaXZlX3NlcnZlcl9leHBlcmltZW50Ijp7InNlcnZpY2VfcG9ydCI6IjE3MDAwIn19fQ%3D%3D&a=ATiAO7IBgkxJpDTS",
"embed_html": "<iframe src=\"https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2Fjonathan.apphus%2Fvideos%2F1659765184096064%2F&width=360\" width=\"360\" height=\"640\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" allowFullScreen=\"true\"></iframe>",
"id": "1659765194096063"
}
The stream is set to public, so anyone from within or outside of Facebook should be able to view it. My problem is that I am not able to view the stream using the "stream_url" (or "secure_stream_url"). I am trying to view it using VLC (have tried both the desktop app and the VLCKit lib on iOS).
Btw, the https link from the iframe works. I am able to view the stream in the browser using this link.
The stream_url returned is only for forwarding the encoded video stream, not for receiving.
If you want to view the live video, use dash_preview_url field of the live video.
You can use graph api to get this url by sending a GET request at this end point:
/LIVE_ID?fields=dash_preview_url&access_token=YourAccessToken
This will return a url which can be played using any Dash Player.
As far as I know, VLC currently does not have support for MPEG-DASH.
Related
I have both an Web application and a Mobile (Ionic) application that has this feature to play Vimeo videos uploaded by the user to the Vimeo account configured in the environment.
So in the web application, I'm able to play the video in the component mounting a simple player.vimeo url this way:
function getUrlVimeo(videoid) {
return $sce.trustAsResourceUrl("//player.vimeo.com/video/" + videoid);
}
And so the api request looks like that:
Vimeo API request to play video (web-side) (internal redirect)
Vimeo API request to play video (web-side)
Note the Referer request header: the url that's sent on this header is the web application url.
But I've noticed I can't play the same video on Mobile (Ionic) application probably because of the Referer request header, that is sent correctly when on web application because the browser does it automatically, but the same doesn't happen on Ionic 3 Mobile application.
Code sample inside ngOnInit() method on the page that reproduces the video on Mobile application, this.href is set as the video id for the Vimeo Video component:
console.log('video-link-player-vimeo page .... ngOnInit()');
if(this.isCourse) {
this.href = this.conteudoVideoDetail.data.href;
} else {
this.href = this.trailContent.data.href;
}
var options01 = {
id: this.href
};
this.Vimeo = window['Vimeo'];
this.player = new window['Vimeo'].Player('player_vimeo', options01);
But this causes the following privacy error:
Privacy error on ionic mobile
The API request on Mobile looks like that:
Vimeo API request to play video (mobile - ionic)
I believe if I could set the Referer request header to the the environment url (same as web), it would work, but Ionic automatically sets it to http://localhost/ and I can't seem to find a way to change it.
Is there any way I can do that or overcome this privacy setting error in any way?
I created a chatbot on Dialogflow which informs the user about the names of the members of my (extended) family and about where they are the living. I have created a small database with MySQL which has these data stored and I fetch them with a PHP script whenever this is appropriate depending on the interaction of the user with the chatbot.
I have integrated this chatbot to Facebook Messenger. My question is the following:
Can I directly trigger the Facebook messenger camera to be turned on through Dialogflow (and without using any other front-end camera)?
The reason I want to turn on the camera is to allow the user to take a photo of himself/herself and then I will process the photo with some computer vision libraries to infer if this person at the photo is a family member of mine. Obviously, I can simply create another basic front-end where I will turn on a camera whenever e.g. an intent called 'Camera' is triggered but I was wondering if can do this directly on facebook messenger.
The json response that I am receiving at my back-end from Dialogflow contains only the following UI capabilities:
"surface": {
"capabilities": [
{
"name": "actions.capability.MEDIA_RESPONSE_AUDIO"
},
{
"name": "actions.capability.SCREEN_OUTPUT"
},
{
"name": "actions.capability.AUDIO_OUTPUT"
},
{
"name": "actions.capability.WEB_BROWSER"
}
]
}
therefore my first impression is that turning on a camera directly through Dialoglfow (and Facebook Messenger) is not possible.
Am I right?
Well, you're right... but probably not for the reasons you think.
First, you're not going to be able to turn on the Facebook Messenger camera because you're not using Facebook Messenger. You're using the Google Assistant. Right now, the Google Assistant doesn't define a way to send an image to the Action you're interacting with. (It does work with Google Lens, but at this point, there is no way to get that to you.)
Second, you wouldn't actually "turn on" the camera. If the user sends you an image through the Messenger camera, you can process this by looking at the originalRequest field in the JSON you get on your fulfillment which should contain the message from Facebook which contains the image.
I am trying to access the live views count of a live video that is live through a Facebook Page. I am using the ID that I am obtaining from the API request {page-id}/videos/uploaded When I am using that video id and making a GET request of {video-id}?fields='live_views its showing error code of 100 with the message as:
(#100) Tried accessing nonexisting field (live_views) on node type (Video)
I have the following permissions:
'manage_pages', 'publish_pages', 'business_management', 'read_insights', 'user_videos'
I am making the GET request using user_access_token.
I am using Graph API Version 2.8.
Please let me know if I am using the wrong ID. IF yes, then how can i get the live_video_id of a live video posted in page?
To get the live views count of a video a fan page, you need:
An app created at facebook developer
A user access token (for testing, e.g. by calling https://developers.facebook.com/tools/accesstoken/)
The fan page id
With this you can call graph API in the following format:
https://graph.facebook.com/v2.8/<fan_page_id>/live_videos?access_token=<access_token>?fields=live_views
Of course, you may add more elements in fields parameter if you need more information. Here Facebook's Graph API explorer helps: https://developers.facebook.com/tools/explorer
When you add status to fields parameter, "LIVE" means, it's currently live, "VOD" means it has already finished.
If you try to implement a WebHook for it, let me now if it works. Thanks.
To get live views you need to call the api with the live video id, which you get from calling, page id can initially be either the page-id or name
"https://graph.facebook.com/v10.0/${page_id}/live_videos?access_token=${access_token}
Sample response:
{
"title": "hello world 2",
"status": "LIVE",
"embed_html": "...,
"id": "123123" // this is the live video id
},
After you have retrieved the live video id you can call this endpoint to get the live_views edge
https://graph.facebook.com/v10.0/${live_id}fields=live_views&access_token=${access_token}
sample response:
{
"live_views": 1,
"id": "123123"
}
Docs for endpoint 1: https://developers.facebook.com/docs/graph-api/reference/live-video/
Docs for endpoint 2: https://developers.facebook.com/docs/graph-api/reference/live-video/reactions#Reading
However I understand the confusion since live_views is not listed under the second endpoint as a reaction nor even is it a reaction, so either it a mistake in facebook docs or a mistake in the graph API, either the solution provided works.
Yes you do need to go through an app review to get the permission for tracking streams
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"
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