Reputation: 143
I want to share a .mp4 video with Instagram API using PHP. I use the following codes for sharing. Even though I entered the media_type parameter as REELS, I get this error. I wonder where the problem is?
$config = array( // instantiation config params
'user_id' => $myInstagramBusinessAccId,
'access_token' => $myFacebookAccessToken,
);
// instantiate user media
$media = new Media( $config );
$videoContainerParams = array(
'caption' => $caption,
'video_url' => $videoUrl,
'thumb_offset' => 1000,
'share_to_feed' => false,
'media_type' => "REELS",
);
// create video container
$videoContainer = $media->create( $videoContainerParams );
echo '<pre>';
print_r($videoContainer);
return;
[error] => Array ( [message] => Invalid parameter [type] => OAuthException [code] => 100 [error_subcode] => 2207067 [is_transient] => [error_user_title] => Desteklenmeyen medya türü VİDEO [error_user_msg] => Media_type için VIDEO değeri kullanımdan kaldırıldı. Instagram akışında bir video yayınlamak için REELS medya türünü kullan. Bir video yayınlamak için lütfen https://developers.facebook.com/docs/instagram-api/reference/ig-user/media#creating adresini ziyaret et. [fbtrace_id] => A40AryGmv1WLJ_T3BwpWOKb )
Upvotes: 0
Views: 562
Reputation: 50
It looks as though you are using the github jstolpe/instagram-graph-api-php-sdk.
If that is the case then hard coded in their code is 'media_type' => 'VIDEO'
If you comment it out .. should work. I think you can find it in instgram/user/media.php around line 86 or so, comment out this line:
$postParams['params'][Params::MEDIA_TYPE] = MediaTypes::VIDEO;
Rgds
Mike
Upvotes: 1