Forum

Thread tagged as: Problem, Error, Addons

Issues with YouTube Addon

I'm getting PHP error notices when using the YouTube addon.

Notice: Undefined index: width in /vagrant/playsthething/public/admin/addons/fieldtypes/youtube/youtube.class.php on line 113
Notice: Undefined index: height in /vagrant/playsthething/public/admin/addons/fieldtypes/youtube/youtube.class.php on line 114
Notice: Undefined index: width in /vagrant/playsthething/public/admin/addons/fieldtypes/youtube/youtube.class.php on line 113
Notice: Undefined index: height in /vagrant/playsthething/public/admin/addons/fieldtypes/youtube/youtube.class.php on line 114

I don't have any problems displaying or playing back the video and it isn't an issue on the production server, as php notices aren't displayed. It's only an issue on my development server.

I did note that someone else on the forum had a similar issue. Any ideas what the problem is?

I've uploaded a screen capture of the error and call stack.

Diagnostic Report

Perch: 2.8.32, PHP: 5.6.23-1+deprecated+dontuse+deb.sury.org~trusty+1, MySQL: 5.5.52, with PDO
Server OS: Linux, fpm-fcgi
Installed apps: content (2.8.32), assets (2.8.32), categories (2.8.32), perch_blog (5.0), perch_forms (1.8.3), perch_comments (1.2), perch_mailchimp (3.0.1)
App runtimes: <?php include(PERCH_PATH.'/core/apps/content/runtime.php'); include(PERCH_PATH.'/core/apps/categories/runtime.php'); include(PERCH_PATH.'/addons/apps/perch_comments/runtime.php'); include(PERCH_PATH.'/addons/apps/perch_blog/runtime.php'); include(PERCH_PATH.'/addons/apps/perch_forms/runtime.php'); include(PERCH_PATH.'/addons/apps/perch_mailchimp/runtime.php'); ?>
PERCH_LOGINPATH: /admin
PERCH_PATH: /vagrant/playsthething/public/admin
PERCH_CORE: /vagrant/playsthething/public/admin/core
PERCH_RESFILEPATH: /vagrant/playsthething/public/admin/resources
Image manipulation: GD Imagick
PHP limits: Max upload 64M, Max POST 64M, Memory: 128M, Total max file upload: 64M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
HTTP_HOST: playsthething.192.168.22.10.xip.io
DOCUMENT_ROOT: /vagrant/playsthething/public
REQUEST_URI: /admin/core/settings/diagnostics/
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php
Damian Lewis

Damian Lewis 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

This video? https://www.youtube.com/watch?v=8x8X_dt4Tv8

It's working fine here. The only time I can get that error is if the given ID returns no search results from the Google API.

Hi Drew

Yes, that's the video I've tried, I also tried a couple of others with the same result.

As I said, it displays and playbacks on the website without any problems. It's just the PHP notices about the undefined width and height on the dev server.

Drew McLellan

Drew McLellan 2638 points
Perch Support

If you turn on debug, do you see the resulting JSON back from the YouTube API in orange?

Are you referring to perch debug? If so, with perch debug on, I see the same resulting screen as before. I don't see any JSON.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, on the control panel page when you save the content that includes the video.

Yes, I found this orange JSON in the debug messages. It' the only JSON thats in orange.

{ "error": { "errors": [ { "domain": "usageLimits", "reason": "ipRefererBlocked", "message": "The request did not specify any referer. Please ensure that the client is sending referer or use the API Console to remove the referer restrictions.", "extendedHelp": "https://console.developers.google.com/apis/credentials?project=558087779479" } ], "code": 403, "message": "The request did not specify any referer. Please ensure that the client is sending referer or use the API Console to remove the referer restrictions." } }
Rachel Andrew

Rachel Andrew 394 points
Perch Support

I googled ipRefererBlocked and there was lots of info, including this: https://stackoverflow.com/questions/13407482/youtube-embed-gives-restricted-from-playback-on-certain-sites-error-despite-ap

So it looks like restrictions applied to the video.