function processAdCreatives(ad) {
        const adElement = ad.data;

        if (!adElement) {
            return;
        }

        const creativeElements = Array.from(adElement.getElementsByTagName('Creative'));

        if (creativeElements.length) {
            for (let i = 0; i < creativeElements.length; i++) {
                const creativeElement = creativeElements[i];

                try {
                    if (ad.adType === 'linear') {
                        const linearCreatives = creativeElement.getElementsByTagName('Linear');
                        const creativeLinear = linearCreatives[0];

                        //Extract the Ad data if it is actually the Ad (!wrapper)
                        if (!playerInstance.hasVastAdTagUri(adElement) && playerInstance.hasInLine(adElement)) {
                            //Set initial values
                            ad.adFinished = false;
                            ad.vpaid = false;

                            //Extract the necessary data from the Linear node
                            ad.skipoffset = playerInstance.convertTimeStringToSeconds(creativeLinear.getAttribute('skipoffset'));
                            ad.clickthroughUrl = playerInstance.getClickThroughUrlFromLinear(creativeLinear);
                            ad.duration = playerInstance.getDurationFromLinear(creativeLinear);
                            ad.mediaFileList = playerInstance.getMediaFileListFromLinear(creativeLinear);
                            ad.adParameters = playerInstance.getAdParametersFromLinear(creativeLinear);
                            ad.iconClick = ad.iconClick || playerInstance.getIconClickThroughFromLinear(creativeLinear);

                            if (ad?.mediaFileList?.length && ad.mediaFileList[0]?.apiFramework === 'VPAID') {
                                ad.vpaid = true;
                            } else if (!ad?.mediaFileList?.length && ad?.adParameters) {
                                // Inject adParameters media as mediaFileList
                                // In VAST, it's also allowed to provide the media in AdParameters, instead of MediaFiles. Although, not industry standard
                                // This is a workaround, since the player expects VAST to not have adParameters
                                try {
                                    const mediaFileObj = JSON.parse(ad?.adParameters?.trim());
                                    if (mediaFileObj) {
                                        ad.mediaFileList = [{
                                            'src': mediaFileObj?.videos?.length ? mediaFileObj?.videos[0]?.url : '',
                                            'type': mediaFileObj?.videos?.length ? mediaFileObj?.videos[0]?.mimetype : ''
                                        }];
                                    }
                                } catch (error) {
                                    console.error("Error parsing media file URL:", error);
                                }
                                ad.adParameters = null;
                            }
                        }
                    }

                    if (ad.adType === 'nonLinear') {
                        const nonLinearCreatives = creativeElement.getElementsByTagName('NonLinearAds');
                        const creativeNonLinear = nonLinearCreatives[0];

                        //Extract the Ad data if it is actually the Ad (!wrapper)
                        if (!playerInstance.hasVastAdTagUri(adElement) && playerInstance.hasInLine(adElement)) {
                            //Set initial values
                            ad.vpaid = false;

                            //Extract the necessary data from the NonLinear node
                            ad.clickthroughUrl = playerInstance.getClickThroughUrlFromNonLinear(creativeNonLinear);
                            ad.duration = playerInstance.getDurationFromNonLinear(creativeNonLinear); // VAST version < 4.0
                            ad.dimension = playerInstance.getDimensionFromNonLinear(creativeNonLinear); // VAST version < 4.0
                            ad.staticResource = playerInstance.getStaticResourceFromNonLinear(creativeNonLinear);
                            ad.creativeType = playerInstance.getCreativeTypeFromStaticResources(creativeNonLinear);
                            ad.adParameters = playerInstance.getAdParametersFromLinear(creativeNonLinear);

                            if (ad.adParameters) {
                                ad.vpaid = true;
                            }
                        }
                    }

                    // Current support is for only one creative element
                    // break the loop if creative was successful
                    break;
                } catch (err) {
                    if (creativeElement.firstElementChild &&
                        !(creativeElement.firstElementChild.tagName === 'Linear' ||
                            creativeElement.firstElementChild.tagName === 'NonLinearAds')) {
                        console.warn('Skipping ' + creativeElement.firstElementChild.tagName + ', this might not be supported yet.')
                    }
                    console.error(err);
                }
            };
        }

        return ad;
    }
Process the XML response

@param ad