Open thathsara-senarathne-azbow opened 1 week ago
@thathsara-senarathne-azbow can you please share the URL of the video that you were trying to play?
Unfortunately it seems the player.vimeo.com/video/{id}/config is not public anymore. This is what Vimeo support told me. So it's required to use their Vimeo API https://developer.vimeo.com/api/files/video-links
@thathsara-senarathne-azbow @superm0 @dbeltram got any solution for this issue
@balasahebkapare123 i have used this ( https://developer.vimeo.com/api/files/video-links ) Vimeo API from a PHP backend and got the needed video URLs with the Quality types and implemented that service to the iOS app. Now it's working fine.
Thanks @thathsara-senarathne-azbow which changes we need to do in iOS side. Is there available any sample example.
@balasahebkapare123 I have to discontinue using this particular library in iOS side. Now i'm Just passing the URL to the AVPlayer which comes from my PHP script.
PHP side code to decode the json and get Video URLs with Quality type
// Your Vimeo Access Token
$accessToken = 'add-your-access-token';
// The Vimeo API endpoint
$apiUrl = "https://api.vimeo.com/videos/{$video_id}";
// Initialize cURL
$ch = curl_init();
// Set the cURL options
curl_setopt($ch, CURLOPT_URL, $apiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer ' . $accessToken,
));
// Execute the cURL request
$curl_response = curl_exec($ch);
// Check for cURL errors
if (curl_errno($ch)) {
$response['status'] = $status;
$response['message'] = $message;
echo json_encode($response);
}
// Decode the JSON response
$data = json_decode($curl_response, true);
// Close the cURL session
curl_close($ch);
$vimeo_data = array();
if (isset($data['play']['progressive'])) {
$vimeo_data['title'] = $data['name'];
foreach ($data['play']['progressive'] as $video) {
$vimeo_data['quality'] = $video['rendition'];
$vimeo_data['url'] = $video['link'];
array_push($result, $vimeo_data);
}
$status = true;
$response['status'] = $status;
$response['message'] = $message;
$response['results'] = $result;
echo json_encode($response);
} else {
$response['status'] = $status;
$response['message'] = $message;
echo json_encode($response);
}
Swift implementation
self.player = AVPlayer(url: url)
self.playerController.player = self.player
let myTime = CMTime(seconds: Double((self.detailObj?.timeSec)!)!, preferredTimescale: 1000)
self.present(self.playerController, animated: true) {
self.playerController.player!.seek(to: myTime, toleranceBefore: .zero,
toleranceAfter: .zero, completionHandler:
{ (isFinished:Bool) -> Void in
self.player.play()
})
}
There seems to be some rate limits for accessing the Vimeo API: https://developer.vimeo.com/guidelines/rate-limiting This may be an issue depending on the target audience. At the moment one solution would be to embed the vimeo player. See https://developer.vimeo.com/api/oembed/videos
In any case, this library is unfortunately not serving its purpose anymore due to the inaccessibility of the player.vimeo.com/video/{id}/config
@balasahebkapare123 I have to discontinue using this particular library in iOS side. Now i'm Just passing the URL to the AVPlayer which comes from my PHP script.
PHP side code to decode the json and get Video URLs with Quality type
// Your Vimeo Access Token $accessToken = 'add-your-access-token'; // The Vimeo API endpoint $apiUrl = "https://api.vimeo.com/videos/{$video_id}"; // Initialize cURL $ch = curl_init(); // Set the cURL options curl_setopt($ch, CURLOPT_URL, $apiUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Authorization: Bearer ' . $accessToken, )); // Execute the cURL request $curl_response = curl_exec($ch); // Check for cURL errors if (curl_errno($ch)) { $response['status'] = $status; $response['message'] = $message; echo json_encode($response); } // Decode the JSON response $data = json_decode($curl_response, true); // Close the cURL session curl_close($ch); $vimeo_data = array(); if (isset($data['play']['progressive'])) { $vimeo_data['title'] = $data['name']; foreach ($data['play']['progressive'] as $video) { $vimeo_data['quality'] = $video['rendition']; $vimeo_data['url'] = $video['link']; array_push($result, $vimeo_data); } $status = true; $response['status'] = $status; $response['message'] = $message; $response['results'] = $result; echo json_encode($response); } else { $response['status'] = $status; $response['message'] = $message; echo json_encode($response); }
Swift implementation
self.player = AVPlayer(url: url) self.playerController.player = self.player let myTime = CMTime(seconds: Double((self.detailObj?.timeSec)!)!, preferredTimescale: 1000) self.present(self.playerController, animated: true) { self.playerController.player!.seek(to: myTime, toleranceBefore: .zero, toleranceAfter: .zero, completionHandler: { (isFinished:Bool) -> Void in self.player.play() }) }
Thanks @thathsara-senarathne-azbow
Recently there is a decode issue from the library, Can you please look into this matter.![Screenshot 2024-07-03 at 13 11 18](https://github.com/superm0/HCVimeoVideoExtractor/assets/141614500/4c740f82-2128-4d50-aa00-211bfcb1f405)