Edit in JSFiddle

(function(){ "use strict";
	window.nivo = window.nivo || {};

	window.nivo.YoutubeAPI = (function(){
		var
			isInitialized = false, // indicates if api was loaded
			isAPIReady = false, // indicates if loaded api is ready
			playerList = [];

		/**
		 * Add a video if it was not added before
		 * @param object player   DOM-Element of the player placeholder "<div data-yt="YT-VIDEO-ID"/>"
		 * @param void
		 */
		function addVideo( player, settings ){
			_init();

			if(player.getAttribute('data-yt-initialized')){
				console.log('[nivo YoutubeAPI] you can not initialize a player twice');
				return;
			}

			var playerObj = {player: player, settings: settings};
			playerList.push( playerObj );

			if(isAPIReady){
				_initPlayerAPI( playerObj );
			}
		}

		/**
		 * Initializes the module once
		 * @return void
		 */
		function _init(){
			if(isInitialized) return;

			isInitialized = true;

			// Youtoube iFrame API calls function 'window.onYouTubeIframeAPIReady' when fully initialized
			// so we map it to the local context
			window.onYouTubeIframeAPIReady = function(){ _onYouTubeIframeAPIReady(); };

			// finally load the Youtube API
			var tag = document.createElement('script');
			tag.src = "https://www.youtube.com/iframe_api";
			var firstScriptTag = document.getElementsByTagName('script')[0];
			firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
		}

		/**
		 * Initialize all added player once the YoutubeAPI is ready
		 */
		function _onYouTubeIframeAPIReady(){
			isAPIReady = true;
			for (var i = 0; i < playerList.length; i++) {
				var playerObj = playerList[i];
				_initPlayerAPI( playerObj );
			}
		}

		/**
		 * Initializes a player
		 * @param  object playerObj {player: DOM-EL, settings: {}};
		 * @return void
		 */
		function _initPlayerAPI( playerObj ){
			// safety first - lets doublecheck if player was not loaded before..
			if(playerObj.player.getAttribute('data-yt-initialized')){
				console.log('[nivo YoutubeAPI] you can not initialize a player twice');
				return;
			}

			// tag player as initialized
			playerObj.player.setAttribute('data-yt-initialized', 'data-yt-initialized');

			var videoId = playerObj.player.getAttribute('data-yt'); // the actual video-id
			var playerId = 'youtube-player-' + videoId; // unique player-id

			playerObj.player.id = playerId;

			// Actual Player initialization
			playerObj.ytPlayer = new YT.Player(playerId, {
				videoId: videoId,
				playerVars: playerObj.settings.playerVars,
				// playerVars: {
				// 	'autoplay': 0, // only applies on non-mobiles
				// 	'controls': 1, // necessary for some mobiles running android in order to get the video playing
				// 	'showinfo': 0,
				// 	'iv_load_policy': 3 // remove the youtube annotations - wo dont have them now but they may come back someday
				// },
				events: {
					'onReady': function(e){
						// invoke callback
						if(typeof playerObj.settings.onReady !== 'function') return;
						playerObj.settings.onReady.call(playerObj.ytPlayer, e);
					},
					'onStateChange': function(e){
						// I assume that nobody wants to play videos at the same time..
						if(e.data === YT.PlayerState.PLAYING){
							_pauseAllOtherVideos(playerObj.ytPlayer);
						}
						// invoke callback
						if(typeof playerObj.settings.onStateChange !== 'function') return;
						playerObj.settings.onStateChange.call(this, e);
					}
				}
			});
		}

		/**
		 * Pauses all videos except passed one
		 * @param  object except  the player that should not be paused
		 * @return void
		 */
		function _pauseAllOtherVideos( ytPlayer ){
			for (var i = 0; i < playerList.length; i++) {
				// do not pause current vide
				if(ytPlayer === playerList[i].ytPlayer) continue;
				// if a video is not playing we do not need to pause it
				if(playerList[i].ytPlayer.getPlayerState() !== YT.PlayerState.PLAYING) continue;
				// pause the vide
				if(typeof playerList[i].ytPlayer.pauseVideo === 'function'){
					playerList[i].ytPlayer.pauseVideo();
				}
			}
		}

		function pauseAllVideos(){
			for (var i = 0; i < playerList.length; i++) {
				if(typeof playerList[i].ytPlayer.pauseVideo === 'function' && playerList[i].ytPlayer.getPlayerState() === YT.PlayerState.PLAYING){
					playerList[i].ytPlayer.pauseVideo();
				}
			}
		}

		/**
		 * expose interface
		 */
		return {
			addVideo: addVideo,
			pauseAllVideos: pauseAllVideos
		};
	}());
	
	/*
	 * INITILIZE VIDEOS
	 */
	[].forEach.call(document.querySelectorAll('div'), function(video){
			window.nivo.YoutubeAPI.addVideo(video, {
				playerVars: {
					'autoplay': 0,
					'showinfo': 0,
					'controls': 1,
          'rel': 0,
          'fs': 0,
					'iv_load_policy': 3 // remove the youtube annotations
				},
				onStateChange: function(e){
					if(e.data === YT.PlayerState.PLAYING){
						console.log('YT.PlayerState.PLAYING')
					}

					if(e.data === YT.PlayerState.PAUSED){
						console.log('YT.PlayerState.PAUSED')
					}

					if(e.data === YT.PlayerState.ENDED){
						console.log('YT.PlayerState.ENDED')
					}
				},
				onReady: function(e){
					// assign api to the player so you can access the api later by
					// document.querySelector('iframe').ytPlayer
					this.f.ytPlayer = this;
				}
			});
		});
}());
<div data-yt="JjCaRS-CABk"></div>

<div data-yt="MHalU4mJmSY"></div>