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

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, privacy policy and cookie policy

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