Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
During some operations, the BrightcoveVideo.php loads the Video from Brightcove. However we don't have access to this object in operations like hook_entity_presave() and my experience is that calling the API again is inefficient/slow.
I would like the BrightcoveVideo object to store the Video in a property, which can be accessed later, for example:
function mymodule_brightcove_video_presave(BrightcoveVideo $videoEntity) {
/** @var \Brightcove\Object\Video\Video $bcVideo **/
$bcVideo = $videoEntity->getVideo();
$videoEntity->set('someproperty', $bcVideo->someProperty()));
}
Comment | File | Size | Author |
---|---|---|---|
#2 | 2908267-2-access-video-from-entity.patch | 1.9 KB | sime |
Comments
Comment #2
simeAn attempt to solve.
Comment #3
dawehnerI guess this is a duplicate of #2728313: Provide a API helper to get a brightcove video object ?
Comment #4
simeThat is definitely one way to do it. What i noticed is that calling the API again takes twice as long for a lot of videos. So this problem is really more like: why do I have to hit the endpoint again? why is the brightcove module abstracting the Brightcove API response away from me so much that I have to hit the API again to access something?
Comment #5
dawehner@sime
I totally agree with you. At least for me having this video object available was really useful.
Comment #6
daniel.nitsche CreditAttribution: daniel.nitsche as a volunteer commentedIgnore this sorry -- patch is for a different issue.
Comment #7
daniel.nitsche CreditAttribution: daniel.nitsche as a volunteer commentedComment #8
yce CreditAttribution: yce at Pronovix for BrightCove commentedHi,
Why do you have to access the SDK's video entity? Is something missing from the Drupal video entity?
Comment #9
yce CreditAttribution: yce at Pronovix for BrightCove commentedClosing this ticket as there was no feedback.