<template name="videoCall">
	{{#if videoAvaliable}}
		{{#if videoActive}}
			<div class="webrtc-video {{#if overlay}}webrtc-video-overlay{{/if}}">
				<div class="main-video">
					<video src="{{mainVideoUrl}}" autoplay muted="true" class="{{#if $eq mainVideoUrl selfVideoUrl}}video-flip{{/if}}"></video>
					<div>{{mainVideoUsername}}</div>
				</div>
				<div class="videos">
					{{#if selfVideoUrl}}
						<div class="video-item" data-username="$self">
							<video src="{{selfVideoUrl}}" autoplay muted="true" class="{{#unless screenShareEnabled}}video-flip{{/unless}}"></video>
							{{#unless audioAndVideoEnabled}}
								<div class="video-muted-overlay">
									{{#unless audioEnabled}}
										<button><i class="icon-mute"></i></button>
									{{/unless}}
									{{#unless videoEnabled}}
										<button><i class="icon-eye-off"></i></button>
									{{/unless}}
								</div>
							{{/unless}}
							<div>{{_ "you"}}</div>
						</div>
					{{/if}}
					{{#each remoteVideoItems}}
						<div class="video-item {{#unless connected}}state-overlay{{/unless}}" data-state-text="{{stateText}}" data-username="{{id}}">
							<video src="{{url}}" autoplay></video>
							<div>{{usernameByUserId id}}</div>
						</div>
					{{/each}}
				</div>
				<div class="buttons-group">
					{{#if videoActive}}
						<button class="button stop-call"><i class="icon-stop"></i>{{_ "Stop"}}</button>
						{{#if audioEnabled}}
							<button class="button disable-audio" title="{{_ 'Mute'}}" aria-label="{{_ 'Mute'}}"><i class="icon-mute"></i></button>
						{{else}}
							<button class="button enable-audio" title="{{_ 'Unmute'}}" aria-label="{{_ 'Unmute'}}"><i class="icon-mic"></i></button>
						{{/if}}
						{{#if videoEnabled}}
							<button class="button disable-video"><i class="icon-eye-off"></i></button>
						{{else}}
							<button class="button enable-video"><i class="icon-eye"></i></button>
						{{/if}}
						{{#if screenShareAvailable}}
							{{#if screenShareEnabled}}
								<button class="button disable-screen-share"><i class="icon-desktop"></i></button>
							{{else}}
								<button class="button enable-screen-share"><i class="icon-desktop"></i></button>
							{{/if}}
						{{/if}}
						{{#if overlayEnabled}}
							<button class="button disable-overlay"><i class="icon-resize-small"></i></button>
						{{else}}
							<button class="button enable-overlay"><i class="icon-resize-full-alt"></i></button>
						{{/if}}
					{{/if}}
				</div>
			</div>
		{{/if}}
	{{/if}}
</template>
