0

I've just installed Dukt Videos 1.2.1 (the latest) on EE 2.7.2 and connected it to Vimeo which worked fine. However, when trying to publish an entry to a channel which uses the video field (in Matrix) I get this

TypeError: Cannot read property 'length' of undefined
 at Function.b.extend.each (http://example.com/themes/javascript/compressed/jquery/jquery.js?v=1385992367:36:478)
    at Object.MainCtrl.$scope.providerRouting (http://example.com/themes/third_party/dukt_videos/components/videos-common/js/angular/controllers.js:225:5)
    at http://example.com/themes/third_party/dukt_videos/components/videos-common/js/angular/controllers.js:46:12
    at http://example.com/themes/third_party/dukt_videos/components/bower_components/angular-resource/angular-resource.js:413:30
    at wrappedCallback (http://example.com/themes/third_party/dukt_videos/components/bower_components/angular/angular.js:6995:59)
    at http://example.com/themes/third_party/dukt_videos/components/bower_components/angular/angular.js:7032:26
    at Object.Scope.$eval (http://example.com/themes/third_party/dukt_videos/components/bower_components/angular/angular.js:8218:28)
    at Object.Scope.$digest (http://example.com/themes/third_party/dukt_videos/components/bower_components/angular/angular.js:8077:25)
    at Object.Scope.$apply (http://example.com/themes/third_party/dukt_videos/components/bower_components/angular/angular.js:8304:24)
    at done (http://example.com/themes/third_party/dukt_videos/components/bower_components/angular/angular.js:9357:20) 

Anyone know what might be going on?

1
  • This problem usually happens when there is a connection problem between EE and the video gateway you're trying to use. Can you give some context on how it's been configured ? Did you manage to successfully connect with Vimeo before dealing with the field ? Videos has an update planned for next week, and it's all gonna be about error handling, with human readable ones :) Just sent you an email asking for more infos on your config. Thanks ! Dec 3 '13 at 10:53
2

Finally found the origin of the problem, which comes from an old bug with the Vimeo API.

Short version is that there is a bug happening when you have only one Vimeo album.

Long version is that the Vimeo API was requested for a list (array) of your albums, and if you had only one album created, was returning the album object, straight, instead of an array of albums (even if dealing with only one).

This particular situation was handled, but now that they have fixed the problem on their end, it's throwing bugs to people using Videos with only one album.

Will be fixed in the next update.

For now, you can whether create an additional album or comment the following lines in dukt_videos/vendor/dukt/videos/src/Dukt/Videos/Vimeo/Service.php (~ line 553), to make it look like this :

private function extractCollections($r, $type='album')
{
    $responseCollections = $r;

    $collections = array();


    // if(count($responseCollections) == 1) {
    //     $responseCollections = array($responseCollections);
    // }

    foreach($responseCollections as $responseCollection)
    {
        $collection = new Collection();

        $collection->{'instantiate'.ucwords($type)}($responseCollection);

        array_push($collections, $collection);
    }

    return $collections;
}

Hope this helps !

2
  • Excellent, can confirm that this fix works. Thanks for the swift response :-) Dec 3 '13 at 16:21
  • Got this error when updating another old site today from "VideoPlayer" to "Dukt Videos" on EE 2.9 .. so needed to patch the above since the Dukt Videos release has not been updated yet. Also, there's another bug that affects PHP 5.4.4+ - in the frontend you'll get this error: Severity: Warning Message: sprintf(): Too few arguments Filename: Common/AbstractVideo.php Line Number: 226 To fix open that php file and replace the sprintf line with this: $embed = str_replace('%s', $this->id, $format); Jul 16 '14 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.