vimeo / vimeo.php

Official PHP library for the Vimeo API.
https://developer.vimeo.com
Apache License 2.0
450 stars 210 forks source link

Unable to initiate an upload. [Unable to upload video. Please get in touch with the app's creator.] #188

Closed tnylea closed 5 years ago

tnylea commented 5 years ago

Hey Guys,

I'm trying to use the API to allow users to upload videos through my application; however, I am not able to upload videos due to the following error:

screen shot 2018-11-30 at 9 12 45 am

I've already created an access_token that gives my application upload permissions. I've also verified that the file is located in the correct place, but I'm still having no luck.

I'm seeing the same issue here: https://github.com/vimeo/vimeo.php/issues/171 But the only solution provided was to contact support. So, I will be contacting support as well with a link to this issue.

Here is the code that I am using below.

$lib = new Vimeo($this->vimeo_client_id, $this->vimeo_client_secret, $this->vimeo_access_token);

$file_name = '/path/to/file.mp4';

echo 'Uploading: ' . $file_name . "\n";

try {
    // Upload the file and include the video title and description.
    $uri = $lib->upload($file_name, array(
        'name' => 'Vimeo API SDK test upload',
        'description' => "This video was uploaded through the Vimeo API's PHP SDK."
    ));
    // Get the metadata response from the upload and log out the Vimeo.com url
    $video_data = $lib->request($uri . '?fields=link');
    echo '"' . $file_name . ' has been uploaded to ' . $video_data['body']['link'] . "\n";
    // Make an API call to edit the title and description of the video.
    $lib->request($uri, array(
        'name' => 'Vimeo API SDK test edit',
        'description' => "This video was edited through the Vimeo API's PHP SDK.",
    ), 'PATCH');
    echo 'The title and description for ' . $uri . ' has been edited.' . "\n";
    // Make an API call to see if the video is finished transcoding.
    $video_data = $lib->request($uri . '?fields=transcode.status');
    echo 'The transcode status for ' . $uri . ' is: ' . $video_data['body']['transcode']['status'] . "\n";
} catch (VimeoUploadException $e) {
    // We may have had an error. We can't resolve it here necessarily, so report it to the user.
    echo 'Error uploading ' . $file_name . "\n";
    echo 'Server reported: ' . $e->getMessage() . "\n";
} catch (VimeoRequestException $e) {
    echo 'There was an error making the request.' . "\n";
    echo 'Server reported: ' . $e->getMessage() . "\n";
}

I'm wondering if this is just an account setting that I need to activate. I've been through the documentation and the code examples, but I'm not able to get past this error.

If you could help me figure out what's going on here or give me more guidance as to how I can resolve it. I'd really appreciate it 👍

Thanks a ton! Talk to you soon.

erunion commented 5 years ago

Hi @tnylea, you're seeing that error because your API app has not yet been granted access to upload videos. If you go into your API app settings on the developer site, you should see a form to fill out and our community team usually handles requests within 24-48 hours.

Haseebfayyaz commented 5 years ago

I am also facing same problem and I have revived a mail your project is approved

erunion commented 5 years ago

@Haseebfayyaz Please contact our support team directly to resolve that. https://vimeo.com/help/contact

aslampathan95 commented 1 year ago

Hii guys,

im getting error of this return errorCallback('Unable to initiate an upload. [' + err + ']') ^

TypeError: errorCallback is not a function

my code: app.get('/play/:videoUrl', (req, res) => { const videoUrl = req.params.videoUrl;

// Read the encrypted video file
const encryptedVideoPath = `uploads/${videoUrl}`;
const encryptedReadStream = fs.createReadStream(encryptedVideoPath);
const encryptionKey = Buffer.from('c53d6cc324cff4c27175d3081e52f0186e3ff72197e021ce71c096920357dcd2', 'hex');
const iv = Buffer.from("83caf7fba094e347b2cac92c0b295f29", 'hex');
console.log(encryptionKey,iv); 

// Create a decipher to decrypt the video
const decipher = crypto.createDecipheriv('aes-256-cbc', encryptionKey, iv);

// Create a decrypted stream
const decryptedStream = encryptedReadStream.pipe(decipher);

// Generate a Vimeo player instance
const vimeoPlayer = vimeoClient.upload(decryptedStream, {}, (error, body) => {
  if (error) {
    console.error('Error occurred while uploading the video to Vimeo', error);
    res.status(500).send('Error occurred while uploading the video to Vimeo');
    return;
  }

  const videoId = body.uri.replace('/videos/', '');
  const vimeoPlayerUrl = `https://player.vimeo.com/video/${videoId}`;

  // Send the Vimeo player URL for redirection
  res.redirect(vimeoPlayerUrl);
});

});