1

Can anyone help me how to fetch the videos details of product in magento2 Apis

I wants display content like below screenshot in my module Api;

please find the screenshot below:

https://prnt.sc/i3ywvq

Thanks

1 Answer 1

0

We Can Load the Product Video Details By using the Below Code:

$galleryImages = $product->getMediaGalleryImages();
if ($galleryImages) {
    foreach ($galleryImages as $image) {
        $imageData = $image->getData();

        // Check media type
        if (isset($imageData['media_type']) && $imageData['media_type'] == 'external-video') {
            // Your code here
        }
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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