Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notice: Undefined property: BCDIAPI::$timeout_retry #2

Closed
hellomrdavis opened this issue Jan 11, 2017 · 0 comments
Closed

Notice: Undefined property: BCDIAPI::$timeout_retry #2

hellomrdavis opened this issue Jan 11, 2017 · 0 comments

Comments

@hellomrdavis
Copy link

Almost there. My variables are correct that I'm sending to the API but I'm getting the following error at line 445 in the bc-diapi.php file.

Here is the code on my page. I'm pulling settings from a custom Wordpress settings page and from a custom post type being saved/updated:

`function save_ndms_videos_meta( $post_id, $post, $update ) {
if (isset($post->post_status) && 'auto-draft' == $post->post_status) {
return;
}

// Update the custom fields in the database.
$postTitle = get_the_title();

// $poster_uploaded_url = "";
// $thumbnail_uploaded_url = "";
// update_post_meta( $post_id, 'ndms-tags', $_POST['ndms-tags'] );
$thumbnail_uploaded_url = ndms_update_image($post_id,'thumbnail',$postTitle);
$poster_uploaded_url = ndms_update_image($post_id,'poster',$postTitle);

if(isset($_POST["ndms-short-desc"])){
update_post_meta( $post_id, 'ndms-short-desc', $_POST["ndms-short-desc"] );
$videoShortDesc = $_POST['ndms-short-desc'];
}else{
$videoShortDesc = "";
}

if(isset($_POST["ndms-long-desc"])){
update_post_meta( $post_id, 'ndms-long-desc', $_POST["ndms-long-desc"] );
$videoLongDesc = $_POST['ndms-long-desc'];
}else{
$videoLongDesc = "";
}

if(isset($_POST["ndms-thumbnail"])){
$videoThumbnail = get_post_meta( $post->ID, 'ndms-thumbnail', true );
}else{
$videoThumbnail = "";
}

if(isset($_POST["ndms-poster"])){
$videoPoster = get_post_meta( $post->ID, 'ndms-poster', true );
}else{
$videoPoster = "";
}

if(isset($_FILES["ndms-video"])){
// $videoFile = get_post_meta( $post->ID, 'ndms-video', true );
$videoFile = $_FILES["ndms-video"]["name"];
}else{
$videoFile = "";
}

/**

  • Push to Brightcove API
    */

// Create Brightcove API Access Token

// Include the BCDIAPI SDK
require 'dist/bc-diapi.php';

$options = get_option('plugin_options');
$videoToken = $options['video_feed_token'];
$videoTag = $options['video_tag'];
$playerPageSize = $options['video_page_size'];
$videoURL = $options['video_url'];
$playerAccount = $options['player_account'];
$playerID = $options['player_id'];
$bcClientId = $options['brightcove_client_id'];
$bcClientSecret = $options['brightcove_client_secret'];

// account information
$account_data = '{
"account_id": "{$playerAccount}",
"client_id": "{$bcClientId}",
"client_secret": "{$bcClientSecret}"
}';

// Instantiate the class, passing it the account information
$bcdi = new BCDIAPI($account_data);

// to ingest new video (upload source files)
$video_metadata = '{"name":"'.$postTitle.'","description": "'.$videoShortDesc.'", "long_description" : "'.$videoLongDesc.'", "tags":"'.$videoTag.'"}';
$push_ingest_data = '{"profile": "videocloud-default-v1","capture-images": false,"callbacks": ["http://solutions.brightcove.com/bcls/di-api/di-callbacks.php"]}';
$file_paths = '{"video": '.$videoFile.',"poster": "'.$poster_uploaded_url.'","thumbnail": "'.$thumbnail_uploaded_url.'"}';
$file_paths = '{"poster": "'.$poster_uploaded_url.'","thumbnail": "'.$thumbnail_uploaded_url.'"}';
$text_tracks = '[{"srclang": "en","kind": "captions","label": "EN","default": true}]';

// sendToBrightcove($postTitle, $videoShortDesc, $videoLongDesc, $videoTag, $videoToken, $bcClientId, $bcClientSecret); // Push to Brightcove

$push_options = new stdClass();
$push_options->video_options = $video_metadata;
$push_options->ingest_options = $push_ingest_data;
$push_options->file_paths = $file_paths;
$push_options->text_tracks = $text_tracks;

// make a request
$responses = $bcdi->ingest_request($push_options);
}
add_action( 'save_post_ndms_videos', 'save_ndms_videos_meta', 10, 3 );`

Here are the full errors being spit out:
`Notice: Undefined property: BCDIAPI::$timeout_retry in /var/www/html/wp-content/plugins/ndms-video/dist/bc-diapi.php on line 445

Fatal error: Uncaught BCDIAPIApiError: API error' in /var/www/html/wp-content/plugins/ndms-video/dist/bc-diapi.php:456 Stack trace: #0 /var/www/html/wp-content/plugins/ndms-video/dist/bc-diapi.php(349): BCDIAPI->send_request(Array) #1 /var/www/html/wp-content/plugins/ndms-video/dist/bc-diapi.php(316): BCDIAPI->make_request('get_token', NULL) #2 /var/www/html/wp-content/plugins/ndms-video/dist/bc-diapi.php(355): BCDIAPI->get_access_token() #3 /var/www/html/wp-content/plugins/ndms-video/dist/bc-diapi.php(170): BCDIAPI->make_request('create_video', '{"name":"Patrio...') #4 /var/www/html/wp-content/plugins/ndms-video/ndms-video.php(382): BCDIAPI->ingest_request(Object(stdClass)) #5 /var/www/html/wp-includes/class-wp-hook.php(298): save_ndms_videos_meta(2607, Object(WP_Post), true) #6 /var/www/html/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters('', Array) #7 /var/www/html/wp-includes/plugin.php(453): WP_Hook->do_action(Array) #8 /var/www/html/wp-includes/post.php(3494): do_action('save_post_ndms_...', 2607, Object in /var/www/html/wp-content/plugins/ndms-video/dist/bc-diapi.php on line 456`

Any insight into the issue would be greatly appreciated. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant