Can't play some Vimeo videos. Is it possible to set Referer request header on ionic - ionic-framework

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?

Related

how to play private video from vimeo in flutter

what I'm getting from my Vimeo account is an id and token.
`var response = await http .get('https://player.vimeo.com/video/' + videoId + '/config');`.
And I tried to get the video URL using. But since it is a private video
not able to fetch URL using this method. Is there any better way to
play private video from Vimeo?
You have to authenticate in your Vimeo account that's own this video, and this can be do in many ways, i recommended to use the Access Token, that is a static token that can be storage on your backend database for security principles.
You can reach this authenticate ways here.
After authenticate, you can reach any info about your videos doing a GET request:
Url: *https://api.vimeo.com/videos/*[video_id]
Header: {'Authorization': bearer [Access_Token]}
To more informations about this request, you can reach the Vimeo official documentation.

How to get the site url for Facebook API on device? [Cordova Project]

I'm using facebook API in my cordova project for the first time, I'm trying to get only name and picture from user's facebook, so what I but in settings -> Site URL http://localhost:4400/ and everything works well. The problem is when I test my application on Device showing me a message "Can't Load URL: The domain of this URL isn't included in the app's domain"
in PC window.location returns (http://localhost:4400/)
in Device window.location returns (file:///andriod_asset/www/sign.html) so I cant use it because URL must begin with http or https
any solutions or explains, please ?

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.

Facebook Live Stream Static URL

I was curious as to if there is anyway to have a certain page on Facebook have a static URL for it's Live Streams. I want this so I can use that static URL and embed it on a website (Weebly or Wordpress). Does anyone know of a way to do this?
Any and all input is greatly appreciated.
Thanks much!
No, currently there is no such direct feature provided by Facebook to achieve what you want to do. But there is definitely an indirect way of doing this using Facebook Graph API.
Indirect method of doing so:
Use your page ID to get status of last live video of your page.
/Page_ID?fields=live_videos.limit(1){status}
If you get status field as 'LIVE', it means your video is still LIVE on your page. Then, use the returned Video Id of Live video to make next request.
You can get the embed html of the live video using this request:
/Video_ID?fields=embed_html
Use the returned embed_html to embed live video in your wordpress site.
You just need to write the script that executes the above task and embed video conditionally if the status of video is LIVE otherwise not.
This is a pretty old question, but here's my solution:
Make a GET request to https://facebook.com/PAGE_ID/live
Capture the redirect - this request redirects to the URL you want
How I did it in Node.JS
const https = require("follow-redirects").https;
const PageID = "nexe32"
let redirected = false;
https.get({
host: 'facebook.com',
path: `/${PageID}/live`,
headers: {
"User-Agent": 'curl/7.43.0'
},
beforeRedirect: (opts) => {
if(!redirected) {
redirected = true;
} else {
console.log(opts.href); // the URL you want
redirected = false;
}
}
});
``

Ajax call to check if native iPhone application exists on the device?

For our iPhone native application we have a URL : example://
On the iPhone if I type this URL (example://) in safari it automatically opens up my application.
From my "regular" website I have a link which when the user clicks it opens the application. The problem is that if the application is not installed on the iPhone it throws "Unable to open" error.
So before rendering the link on my "regular" site I need to check if the app is installed, one solution is to make an Ajax call and check for status code:
$.ajax({
type: 'POST',
url: 'example://',
complete: function (transport) {
if (transport.status == 200) {
alert('Success');
} else {
alert(transport.status);
alert('Failed');
}
}
});
But this code is always returning a status code "0".
Is there a way to find out from the web if the native iPhone app is installed?
If u are referring to Mobile Safari, you're out of luck. There's no documented public API that I know of that can do this. Mobile Safari is sandboxed away from the OS.
If it's in a webview within an app, u can request the URL and let the webview delegate talk to the native app / query the handling of example://. Otherwise, no way the browser can know existence of any installed app.