![]() |
|
Vimeo Api? - Baskı Önizleme +- Delphi Can (https://www.delphican.com) +-- Forum: Delphi (https://www.delphican.com/forumdisplay.php?fid=3) +--- Forum: Mobil Platform - FireMonkey (FMX) (https://www.delphican.com/forumdisplay.php?fid=7) +--- Konu Başlığı: Vimeo Api? (/showthread.php?tid=6778) |
Vimeo Api? - Jakarta2 - 14-05-2022 Selamlar; Vimeo api ile çalışan oldu mu? Mobilden video çekip upload ettirmem gerekiyor ama nasıl yapacağımı bulamadım. develeoper Vimeo'ya girdim. Gerekli olan bilgileri aldım ama bunları nasıl kullanacağımı bulamadım. Client identifier Client secrets Token OAuth Redirect Authentication Authorize URL https://api.vimeo.com/oauth/authorize Access token URL https://api.vimeo.com/oauth/access_token Buna benzer bir yolla bağlantı sağlamaya çalışamam çünkü burada wsdl dosyalarını import etmiştim. Vimeo'da ne yapacağımı bilemedim... urunser := productService.GetProductServicePort(False,'',HTTPRIO2); urunaut := productService.Authentication.Create; urunaut.appKey:= getapikey; urunaut.appSecret:= getapisecret; urunresponse := GetProductListResponse.Create(); urunrequest := GetproductListRequest.Create(); urunrequest.auth:= urunaut; uayrintireq := GetProductBySellerCodeRequest.Create; uayrintireq.Auth := urunaut; urunlistesi:= urunser.GetProductList(urunrequest).products; urunresponse := urunser.GetProductList(urunrequest); Cvp: Vimeo Api? - Jakarta2 - 14-05-2022 java dosyasına ve vimeo sayfasına ve linklere bakarak bir kod yazdım ama işe yaramadı. procedure TForm1.Button1Click(Sender: TObject);
var
vboyut: real;
LBuffer: TBytes;
videolink, konum: string;
MemoryStream1: tMemoryStream;
bytes: integer;
LInput: TFileStream;
begin
try
videolink:= 'F:\video\showreel\deneme.mp4';
LInput:= TFileStream.Create(videolink, fmOpenRead);
vboyut:= LInput.Size;
SetLength(LBuffer, trunc(vboyut));
bytes:= LInput.Read(Pointer(LBuffer)^, trunc(vboyut));
MemoryStream1 := TMemoryStream.Create;
MemoryStream1.Write(LBuffer, bytes);
MemoryStream1.Position:= 0;
try
with RESTRequest1 do
begin
AddBody(MemoryStream1,ctVIDEO_MP4);
Params.ParameterByName('name').Value:= 'erol deneme Video';
Params.ParameterByName('description').Value:= 'erol deneme Video';
Execute;
end;
finally
showmessage('Yükleme Tamamlandı');
end;
except
on E: Exception do
begin
ShowMessage(E.Message);
end;
end;
end;
end.
Örnek java kodu 'use strict' /** * Copyright 2013 Vimeo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var Vimeo = require('../index').Vimeo try { var config = require('./config.json') } catch (error) { console.error('ERROR: For this example to run properly you must create an API app at ' + 'https://developer.vimeo.com/apps/new and set your callback url to ' + '`http://localhost:8080/oauth_callback`.') console.error('ERROR: Once you have your app, make a copy of `config.json.example` named ' + '`config.json` and add your client ID, client secret and access token.') process.exit() } if (!config.access_token) { throw new Error('You can not upload a video without configuring an access token.') } // Instantiate the library with your client id, secret and access token (pulled from dev site) var client = new Vimeo(config.client_id, config.client_secret, config.access_token) // Create a variable with a hard coded path to your file system var filePath = '<full path to a video on the filesystem>' console.log('Uploading: ' + filePath) var params = { 'name': 'Vimeo API SDK test upload', 'description': "This video was uploaded through the Vimeo API's NodeJS SDK." } client.upload( filePath, params, function (uri) { // Get the metadata response from the upload and log out the Vimeo.com url client.request(uri + '?fields=link', function (error, body, statusCode, headers) { if (error) { console.log('There was an error making the request.') console.log('Server reported: ' + error) return } console.log('"' + filePath + '" has been uploaded to ' + body.link) // Make an API call to edit the title and description of the video. client.request({ method: 'PATCH', path: uri, params: { 'name': 'Vimeo API SDK test edit', 'description': "This video was edited through the Vimeo API's NodeJS SDK." } }, function (error, body, statusCode, headers) { if (error) { console.log('There was an error making the request.') console.log('Server reported: ' + error) return } console.log('The title and description for ' + uri + ' has been edited.') // Make an API call to see if the video is finished transcoding. client.request( uri + '?fields=transcode.status', function (error, body, statusCode, headers) { if (error) { console.log('There was an error making the request.') console.log('Server reported: ' + error) return } console.log('The transcode status for ' + uri + ' is: ' + body.transcode.status) } ) }) }) }, function (bytesUploaded, bytesTotal) { var percentage = (bytesUploaded / bytesTotal * 100).toFixed(2) console.log(bytesUploaded, bytesTotal, percentage + '%') }, function (error) { console.log('Failed because: ' + error) } ) Cvp: Vimeo Api? - berk06 - 15-05-2022 Merhaba, https://stackoverflow.com/questions/57300880/upload-a-video-to-vimeo-using-their-api-and-curl-post-patch Burayı referans alarak RestDebugger ile bir örnek hazırladım. Dosya seçmeyi ve token girmeyi unutmayın. [attachment=2066] Cvp: Vimeo Api? - Jakarta2 - 16-05-2022 (15-05-2022, Saat: 00:45)berk06 Adlı Kullanıcıdan Alıntı: Merhaba, Cevabınız için çok teşekkür ederim. Dosya seçip, token giriyorum ama kimlik doğrulamasını gerçekleştirmiyor. 401:unauthorized hatası veriyor Cvp: Vimeo Api? - berk06 - 16-05-2022 (16-05-2022, Saat: 14:41)Jakarta2 Adlı Kullanıcıdan Alıntı:(15-05-2022, Saat: 00:45)berk06 Adlı Kullanıcıdan Alıntı: Merhaba, İzlediğim adımları aktarayım o zaman; https://developer.vimeo.com/apps/new adresinden bir app oluşturdum. APP sayfasında ![]() ayarlarıyla bir token oluşturdum. Bu sabit bir token anladığım kadarıyla. Cvp: Vimeo Api? - Jakarta2 - 16-05-2022 (16-05-2022, Saat: 16:27)berk06 Adlı Kullanıcıdan Alıntı:(16-05-2022, Saat: 14:41)Jakarta2 Adlı Kullanıcıdan Alıntı: Cevabınız için çok teşekkür ederim. Selam; Evet bu seçeneklerin hepsini seçince oldu. Teşekkür ederim. Cvp: Vimeo Api? - Jakarta2 - 20-05-2022 Selamlar; Bu kodlarla vimeo'da ki istediğim bilgileri pc'de alıyorum ancak android de bazen segment faul sonra da External Exception 90, 60, b0 gibi hatalar geliyor. Bazen doğrudan External Exception 90, 60, b0 gibi hatalarla karşılaşıyorum. Neden olabilir? procedure Tfmhomeegt.Button4Click(Sender: TObject);
var
Jvalue : TJSONValue;
JSonObject:TJSonObject;
JSonValue,jsonaltvalue:TJSonValue;
jsonArray,jsonaltarray: TJSONArray;
i,j, ks,ts :integer;
Tex : TMemo;
begin
i := 0;
Tex := TMemo.Create(Nil);
RESTRequest1.Method := rmGET;
RESTRequest1.Execute;
JValue := TJSONObject.parseJSONValue(RESTResponse1.Content);
Tex.Text := RESTResponse1.JSONText;
JSonObject := TJSonObject.Create;
JsonValue:=JSonObject.ParseJSONValue(Tex.Text);
JsonValue:=(JsonValue as TJSONObject).Get('data').JSONValue;
jsonarray := Jsonvalue as TJSONArray;
ks := jsonarray.Count;
for i := 0 to ks - 1 do
begin
if (JSONValue is TJSONArray) then
vname := ((JSONValue as TJSONArray).Items[i] as TJSonObject).Get('name').JSONValue.Value;
vlink := ((JSONValue as TJSONArray).Items[i] as TJSonObject).Get('link').JSONValue.Value;
jsonaltvalue := ((JSONValue as TJSONArray).Items[i] as TJSonObject).Get('embed').JsonValue;
jsonaltvalue := ((JSONValue as TJSONArray).Items[i] as TJSonObject).Get('pictures').JsonValue;
vresim := (jsonaltvalue as TJSonObject).Get('base_link').JsonValue.Value;
dersresim := resimleriindir(vresim);
dersekle(ListView2);
end;
JSonObject.Free;
end;
(20-05-2022, Saat: 17:09)Jakarta2 Adlı Kullanıcıdan Alıntı: Selamlar; Buldum. Eğer RESTRequest1.params içinde upload varsa android onu get yapsak da post gibi işleme alıyor ve video göndermeye çalışıyor. O nedenle RESTRequest1.Execute; kodundan önce RESTRequest1.Params.Delete('upload'); kodunu eklersek düzeliyor. RESTRequest1.Method := rmGET;
RESTRequest1.Params.Delete('upload');
RESTRequest1.Execute;
|