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 that you have read and understand our privacy policy and code of conduct.

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