<?xml version="1.0" encoding="UTF-8" standalone="no"?><addon xmlns="http://icplayer.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Vimeo" xsi:schemaLocation="http://icplayer.com ../../tools/addon.xsd">
	<model>
		<property name="movie id" nameLabel="Vimeo_property_movie_id" type="string"/>
	</model>
<css/><view>&lt;iframe 
	src=''
	width='100%' 
	height='100%' 
	frameborder="0" 
	webkitAllowFullScreen 
	mozallowfullscreen 
	allowFullScreen&gt; 
&lt;/iframe&gt;
</view><preview>&lt;img src="" style="width:100%;height:100%"/&gt;
</preview><presenter>function AddonVimeo_create(){
			
	var presenter = function(){};

	const ERROR_MESSAGES = {
		INVALID_ID: "Invalid movie ID"
	};

	presenter.run = function(view, model){
		const src = `https://player.vimeo.com/video/${model["movie id"]}?title=0&amp;byline=0&amp;portrait=0`;
		const sanitizedSrc = window.xssUtils.sanitize(src);
		
		const iframe = view.getElementsByTagName("iframe")[0];
		iframe.setAttribute("src", sanitizedSrc);
	};
	
	presenter.createPreview = function(view, model){
		const src = `https://vimeo.com/api/v2/video/${model["movie id"]}.json`;
		const sanitizedSrc = window.xssUtils.sanitize(src);
		
		fetch(sanitizedSrc, {method: "GET"})
			.then(response =&gt; response.json())
			.then(data =&gt; {
				const thumbnailUrl = data[0].thumbnail_large;
				$(view).children("img:first").attr("src", thumbnailUrl);
			}).catch(error =&gt; {
				showErrorMessage(view);
			});
	};
	
	function showErrorMessage (view) {
		$(view).html(`&lt;p&gt;${ERROR_MESSAGES.INVALID_ID}&lt;/p&gt;`);
	}
	
	return presenter;
}
</presenter></addon>