Check if users computer has access to YouTube - php

I have hosted some customers videos on YouTube and embedded them into their website. It turns out many of the customers however are in countries that block YouTube or their company blocks YouTube.
I am trying to implement some sort of check (using jQuery/Ajax but any method that works is fine) to check if the users browser can access YouTube, if so load the YouTube version of the video via Ajax, if not load a self-hosted version.
I am fine with loading the different videos, but cant get my head around checking if a users computer can access YouTube, I believe an Ajax call wont work as its cross-domain.
Any help would be much appreciated.
Thanks
Jason

Related

Access Shares from a Company on LinkedIn via PHP from Wordpress

I am trying to retrieve the shares of a company on linkedIn (basically just read the stream, as is easily possible on twitter) to display them on a Wordpress website in a custom HTML/CSS styling, so I only need the data. This should happen just in the backend, so no user interaction (as login etc.) should be necessary.[The end result is simply a slider that aggregates the latest social media posts, like twitter, facebook & linkedin. Works for Twitter & FB so far.]
After many hours of research it seems to me that this is not directly possible with an entirely server-side solution?
Can someone direct me if it is possible to do so? There are many php linkedin libs, but all of them seem to direct to some sort of login from which the user is redirected back? (maybe I am mistaken here).
Any help is greatly appreciated!
Take a look if they offer public rss feeds, thats the most simple way. When they offer only protected then search for developer acces from where you can get api access.

Upload directly to Vimeo via form

I need to know a method to upload a video to a VIMEO PRO account using a form and PHP (to get auth). Currently I can send a video directly to Vimeo, using the panel, as was to be expected. But I have some clients that want to upload your videos directly from my their control panel (created by me), outside of vimeo, and I have only a unique PRO account, and I can't share the account data.
Seems that I can do it, based on the page API https://developer.vimeo.com/apis/advanced/upload#post (Uploading via POST).
My doubts are:
Can I really do that, without pass to my clients the Vimeo PRO account data?
It's a secure method (considering that clients respect the agreement with Vimeo)?
I need to upload DIRECTLY to Vimeo, without pass to my server, because I'll have two works: one to upload to server, other to upload from server to vimeo.
Off-topic: I believe I will not have problems with Vimeo, since they are customers of one company, and the account belongs to the company, and the videos will be her responsibility.
How should work
User access my panel, with your credentials;
User access the video upload page;
Probably the server will contact Vimeo to get an uploader auth;
User will select your vimeo file and submit form;
System will receive the vimeo ID and everyone will be happy forever.
Thanks!
Edit: This feature is now supported by Vimeo's (in beta) API3. You can request access at https://vimeo.com/help/contact
The below information is still accurate in regards to the Advanced API
This feature is not reliably supported by the advanced api.
The primary issue is that with client side uploads, there is no way to tell the upload server what to do once the upload is complete. Additionally, there is no client side technique to find out whether the upload has completed
You might be able to cheat and have the user upload through an iframe, and have the primary page perform a verify chunks call every couple of seconds. I have not tried this, at the moment it is just a theory. If you attempt this hack, Vimeo would love to know more via their contact page https://vimeo.com/help/contact
The feature you are discussing is on the roadmap for the next version of the API, and an early imperfect version was available at their API Hackday. It might be a better idea to hold off a bit and wait for the official feature.
NOTE: This observation does NOT apply to server side uploads. Because the whole upload process is handled via code on the server, it is extremely easy to tell when an upload is complete.
Answering in 2016: Assuming you have already retrieved an access token from Vimeo (OAuth2) this is a good piece of code to help you create an upload form:
https://github.com/websemantics/vimeo-upload
This gives you the code for the form with a place to drag-drop your video file and calls the upload API:
If you're using WordPress, there is a plugin available that allows you to do just that
http://vimeography.com/add-ons/vimeography-upload/
Source: I made it :)

YouTube data download with cclive & gcap

In a PHP system, my client suggested to download videos AND MAINLY captions from YouTube using the following tools:
cclive
gcap
As I have never heard of these before, my question is does anyone have any experience with them? Both projects seem to be inactive for like one year or so... Do they still work?
Is it possible to download captions for any YT video with them? I have stumbled upon some YT API info that the captions are not available for unauthorized users (i.e. you can only get your own captions if you are authorized with the API)?
Caption tracks can only be accessed via the Data API by the authorized owner of a given video.
The official YouTube Players can access caption data, but they use a different mechanism for accessing that data which is not part of a public API.

JW Player Google Analytics Pro tracking

I am working on a video listing website which uses JW Player and its plugins. Embed code of the video can be placed anywhere in the web but we need to track which video plays in which site and its count of views and plays.
We are using Google Analytics Pro plugin for JW Player to track the traffic. But is there any way for me to track the report to
See all the sites that the player is embedded on to see how many people played the video from that site
How many plays are done for each video from from these sites
Exactly which videos are played
Currently we are using following code inside JW Player
s1.addVariable('gapro.accountid', 'UA-21590286-1');
//alert(this.data.captions[this.slide])
s1.addVariable("gapro.trackstarts","true");
s1.addVariable("gapro.trackpercentage","true");
s1.addVariable("gapro.tracktime","true");
s1.addVariable("gapro.idstring","||Channel Name||-||Story Name||");
Following is a sample embed code for playing a video..
Thanks in advance for the support.
Best Regards
Deepu S Nath
The JW GA plug-in should report which site is hosting the player in the Hostname parameter.
1/ Check that when you play a video on your player embedded on a site, a GIF request is sent to google-analytics.com :
http://www.google-analytics.com/__utm.gif?
utmwv=4.9.2&utms=2&utmn=1209321314&
utmhn=www.longtailvideo.com&utmt=event&
utme=5(Video%20Plays*http%3A%2F%2Fcontent.longtailvideo.com%2Fvideos%2Fbunny.flv*
http%3A%2F%2Fwww.longtailvideo.com%2Faddons%2Fplugins%2F107%2Fget-examples.html%3Faddon%3D107%26vid%3D292%26q%3D)
(I have truncated the request which should be much longer).
2/ Confirm that the utmhn value reported is the hostname of the site where the player is hosted. It looks like the JW player plug in reports the Video Play as an Event where the Category is Play, Action is the file source URL and Label is the URL where the video is played.
3/ In Google Analytics, look for a report displaying Event Labels by Hostnames (or create it using a custom report). You should use a filter to view only Event Label = "Video Plays".
This should show you how many plays you had from each site. You can use similar reports to view which video were player from each site (using Event Action).
On a final note, I do not think that the JW player is tracking 'Load' events - when the player is loaded, so you won't see if a player was loaded but no video played. You can confirm by checking if a GIF request is sent when the player is loaded.
I just found that there is no direct solution for my requirement using the google pro plugin.. Instead we implemented a custom solution as follows..
Created a custom Tracker which uses the google analytics APIs directly instead of "Google Analytics Pro" plugin. For that I have Utilized the JWplayer API to interact with the video player and get the video related data and it was be passed to the Google Analytics API. Later in the Google Analytics account, created a custom report with the required metrics and dimensions.. This helped me to get all the tracking details and create the required report. :) I really appreciate the support I got from Antoine which helped me to understand some basics and move towards a solution.
I just checked your site and found that the embed code consists of iFrame and this is the reason why you are unable to track the hostname at which the embed video gets played.As you are using iframes in the embed video code, you wont be able to track the site details were the video is embedded. You always get storybridge.tv as the site url. (iFrame do not support cross domain interaction)
To avoid this problem we have to use tag (Similar to old Youtube Embed Code) which will help the plugin to get the details of the site at which video is played.

Facebook application with video uploading capabilities

I need to upload video files through Facebook application and later visualize all uploaded videos so that people can vote for a video they like. I searched and read some articles, but I still have questions that are not completely clear for me:
Is it better to use iframe or FBML
If I use iframe is it possible to use input type="file" and PHP to handle the uploading just like on a normal page (not with Facebook PHP SDK)
Please give me an advice what direction to take.
Uploading to Facebook using their API is notoriously difficult; first of all check out the thread on the faceboook dev forum.
I would recommend doing it in an iframe, and you'll need about 60 cigarettes and several large whiskeys to get it working.

Categories