function getVideoSlots()

in apps-rendering/src/client/nativeCommunication.ts [190:216]


function getVideoSlots(): VideoSlot[] {
	const videoSlots = document.querySelectorAll('.js-native-video');

	if (videoSlots.length === 0) {
		return [];
	}

	return Array.from(videoSlots).reduce((slots: VideoSlot[], elem) => {
		const slotPosition = elem.getBoundingClientRect();
		const videoId = elem.getAttribute('data-videoid');
		const posterUrl = elem.getAttribute('data-posterurl');
		const durationString = elem.getAttribute('data-duration');
		const rect = getRect(slotPosition);
		if (videoId && posterUrl) {
			if (durationString && !isNaN(parseInt(durationString))) {
				const duration = parseInt(durationString);
				return [
					...slots,
					new VideoSlot({ rect, videoId, posterUrl, duration }),
				];
			} else {
				return [...slots, new VideoSlot({ rect, videoId, posterUrl })];
			}
		}
		return slots;
	}, []);
}