I want to create API in PHP for uploading videos to jwplayer from an app and view those videos in app. And we are using PHP API for the same andI'm using JWPlayer for first time. So please guide where and how to start this as I downloaded PHP kit. But only one page is there in that kit.
In general we disallow developers from giving end users access to the JW Platform and its API for two reasons:
1) Your API key would have to be available to make a call, this poses a security issue
2) Our API limit as mentioned in our Terms of Service
“…To ensure fair access for all, usage of api.jwplatform.com is limited to 60 calls per minute. Calls that exceed this rate will result in a 429 Rate Limit Exceeded error and will not be executed…”
Instead we suggest you setup an intermediate server that will “enqueue” the requests to JW Platform to ensure you stay below the API call limit and protect your API key.
The PHP-Kit can be found here:
Now that I have created an intermediate server. But I want to upload videos from another server to this one. can you please give me an example code to upload videos to jwplayer server. As I am using PHP api for the same. Please guide me.
Today I tried to get response from video/create and also tried to get other responses by using json_encode function of PHP. But all request response is giving me "False" as output. Please tell me what's the issue. Why I'm not able to access the jwplayer dashboard.
You have three ways to upload videos to us using the JW Platform API:
1) normal file transfer
2) S3 Turbo uploads (faster but different syntax than option 1)
3) fetch upload, where you provide a URL to the video on an existing server and then we go grab it. This is the fastest file transfer speed and the easiest in the code since you do not have to make a second call after /videos/create
I have PHP code examples for all three scenarios, so I will paste them below.
$botr_api = new BotrAPI('my_key', 'my_secret');$params = array();
$params['title'] = 'Fetch Upload Test';
$params['description'] = 'Use the JW Platform API to upload videos';
$params['download_url'] = 'Full URL to the video I want to upload';$response = json_encode($botr_api->call('/videos/create', $params));print $response;
Thank You. AS above issue has been resolved. AS our server is blocking outgoing connections for jwplayer server. Can you provide me list of IP address of jwplayer. So that I can add them in our outgoing connection lists. So that "false" error will not display.
And above code snippet works perfectly. But after uploading the video. I would like to show that video or embed that video to our website. So how to get the embed url for the same. Can you help me to solve this issue?
The response from /videos/create will include the new media ID assigned for this content. You can then access this video using the JSON feed:
Please see our Delivery API documentation at https://developer.jwplayer.com/jw-platform/docs/delivery-api-reference/ for more details. And please note that the video will need some time for transcoding. You can expect the video to be ready in real-time, so if you upload a 10 minute video, it will be ready in 10 minutes.
Thanks for your last reply. I am very happy with your service.
But Now I want one more help from you. Hope that you'll help me in this case also.
As our web service is ready for fetching the video from remote url and upload it to jwplayer dashboard. But now I want to create ans API for the same. So that my API will fetch the videos automatically from remote server and upload it to jwplayer dashboard and give back response of uploaded video to remote server.
Please send me code snippet for the same. As I dont know anything about REST API. And this task needs to be completed with REST API only. Thanks once again
I am afraid that I do not fully understand what you are trying to do.
Here is the way I understand it:
1) Fetch the videos automatically from remote server
2) Upload it to jwplayer dashboard
3) Give back response of uploaded video to remote server
Is this correct?
1) This would depend on how you talk to the remote server. I am not able to assist with a code example for this as it does not include the JW APIs
2) I have provided code examples for the three methods to accomplish this
3) I have demonstrated how our API returns the response with the status, new media ID, etc, so passing that object back to the remote server can be accomplished in a few different ways, but I am not able to assist as this does not include any JW APIs
I wish I could be more helpful, but there are a number of ways to do #1 and #3 and I am not an expert with those as I focus on the use of our JW APIs.
As you have given codes for fetching videos from remote url. That is ok and is working fine.
But remote url i.e. in C# is going to upload video from their domain and will call my api to upload that video to jwplayer dashboard via JW API.
And after uploading video, i have to send back reponse of video url of jwplayer to that remote C# domain.
So I have to create API for the same to run this functionality automatically. In short I will explain the flow as below:-
C# webpage will upload video-->Video url will be generated--> C# webpage will give call to PHP API(i.e.My API to be developed)--> PHP API will fetch that request --> Get Video from Request--> UPload it to JW player dashboard using JW API---> Get response from JW API--> SEnd response in the form of Video_url(i.e http://cdn.jwplayer.com/v2/media/[mediaID]) to C# page.
So this was the flow of video working.
Can you help me to implement API for the same. As I have never created on API. So no knowledge About this concept. Thanks in advance it will be great help for me.
I have never created an API either, and I have never used C#, so I have no expertise or experience to offer. My responsibility is to help customers with the JW Player API methods, and I believe I have done that here.
I am sorry that I cannot assist further. My suggestion would be to try Stack Overflow.
Hope you doing well. Finally I'm able to create my API for JW player video upload. But can you give me a code snippet to fetch the video key from the response we get after video upload from remote url ie.#3 code snippet . I only want to fetch video_key for the uploaded video. So that I'll send that Video_key in url to remote server. Please help me to do this task.
I tried to get video key using #1 code i.e ======================================================================== $jsonDecode = json_decode(trim($response), TRUE); print $uploadUrl = $jsonDecode["link"]["protocol"]."://".$jsonDecode["link"]["address"].$jsonDecode["link"]["path"]."?AWSAccessKeyId=".$jsonDecode["link"]["query"]["AWSAccessKeyId"]."&Expires=".$jsonDecode["link"]["query"]["Expires"]."&Signature=".urlencode($jsonDecode["link"]["query"]["Signature"]); ==========================================================================
I applied above code pattern in #3 code and write it as $key = $jsonDecode["video"]["key"]. And got key for the uploaded video.
But now I want to fetch 'sourceformat' i.e. mp4, flv, mp3, or any other format. Please guide me to fetch the uploaded video format like as above code where i got key for the uploaded video.
Thanks for above given information. Now My API works fine and after making video/create call. Video got created on jwplayer dashboard. And I got link for the video uploaded to jwplayer dashboard but when I hit that link directly to the browser as soon as i got it, The browser shows "FIle Not Found" error. AS till that time video is getting uploaded to jwplayer server.
Please tell me any code or idea that I'll get time for uploading the video to jwplayer or any function where after upload completion I'll display the url for the video uploaded.
Our servers will need a few minutes to transcode any new uploads and make them available in our caches around the world. It is a 1:1 correlations, so I would expect a five minute long video to take about five minutes before the status is Ready at the initial transcode. Please note that it will take additional time to transcode the higher qualities of the video.
Your best option that does not require any API calls against your rate limit is to use the JSON /media/ endpoints I referred you to earlier. You know that each individual quality source is available when it appears in that JSON response. My suggestion would be to use the HLS playback source, if possible, as that will be the optimal viewing experience.
I would like to check in my code that if video status will be ready then only display the video url otherwise no response will be given.
Right now when I call video/create function video got created to server and also I got video url from JWPlayer. But till the video gets uploaded I'm not able to view that video, bowser shows "File Not Found" error.
So I want to code in such a way that on after upload status will be "Ready" then only my page will send the response as a video url. Please help me to solve this issue.
1) Make a videos/show call using the media ID of the video in question, but please note that this will count towards your API rate limit
2) Request the /v2/media feed for that media ID, which does not count towards the API rate limit, but you will need to parse the response and check if the “processing” image URL is in use or for the sources:  block containing MP4s before considering the video to be “ready”
For either option, my suggestion would be to wait for the full duration of the video to check for the first time, as our transcoders will need time to process the first quality variant. So if your video is five minutes long, I would wait five minutes before making the first status check using either of these two method. Our engineers are working on callback functions, but I would not expect these to be available until the end of 2017 at the earliest.
Hope this helps,
This question has received the maximum number of answers.