How to get duration of Youtube video through video id with API call in flutter applicaiton? - flutter

I am actually diplaying youtube vidoes information as a widget before playing them, i am getting the others info like title etc through API call, is it possible to get the videos duration using the video ID?

Yes, with YouTube Data API:
URL:
https://youtube.googleapis.com/youtube/v3/videos?part=contentDetails&id=[VIDEO_ID]&fields=items(contentDetails(duration))&key=[YOUR_API_KEY]
Example:
GET https://youtube.googleapis.com/youtube/v3/videos?part=contentDetails&id=sEVvXIQ_DLY&fields=items(contentDetails(duration))&key=[YOUR_API_KEY] HTTP/1.1
Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json
Result:
{
"items": [
{
"contentDetails": {
"duration": "PT38S"
}
}
]
}
Link to live example in YouTube Data API documentation.

Related

how to get list of images from Instagram Api in flutter

when I login Instagram with simple_auth and not getting list of images from Instagram. from
https://graph.instagram.com/me
queryParameters: {
"fields": "media",
"access_token": user!.token,
},
Use media endpoint:
GET /me/media?fields={fields}&access_token={access-token}
See Get a User’s Media for details.

Empty video_insight response from Facebook

I have a page access token and I'm trying to retrieve the video_insight of my page's videos in the Facebook Graph API Explorer.
The endpoint is returning fine for my first 4 videos and the remaining 2 videos I'm receiving an empty data response.
{
"data": [
]
}
I'm using the same token for all my requests. I have the read_insights permission.
Does anyone know what's causing the empty response?

Is there a way to get the a video file or thumbnail for a video through the linkedin v2 api?

We're able to get metadata about videos via the ugcPosts endpoint and analytics via videoAnalytics, but I'm trying to get the actual video file or a thumbnail of the video.
I'm trying hitting:
https://api.linkedin.com/v2/assets/<ID>?fields=id,recipes&oauth2_access_token=XXX&projection=(*,recipes*(*), privatePlayableStreams*(*),playableStreams*(*))
But the response doesn't have any urls in it:
{
"recipes": [
{
"recipe": "urn:li:digitalmediaRecipe:feedshare-video-captions-thumbnails",
"status": "AVAILABLE"
}
],
"id": "XXX"
}
I'm not sure if the data is not available or if I've got the projection wrong or something else.

Facebook Graph API: cannot playback live video stream (rtmps)

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.

How to get website link stats?

I heard there is a way to get stats for URLs from Facebook using FQL. Is there a way to do this using the Open Graph?
Yes.
You can retrieve link stats from Graph API endpoint.
For example, accessing https://graph.facebook.com/?id=http://example.com will get you a response like this:
{
"id": "http://example.com",
"shares": 47068
}