module.exports = Player var h = require('virtual-dom/h') var hyperx = require('hyperx') var hx = hyperx(h) var util = require('../util') var {dispatch, dispatcher} = require('../lib/dispatcher') // Shows a streaming video player. Standard features + Chromecast + Airplay function Player (state) { // Show the video as large as will fit in the window, play immediately // If the video is on Chromecast or Airplay, show a title screen instead var showVideo = state.playing.location === 'local' return hx`
${showVideo ? renderMedia(state) : renderCastScreen(state)} ${renderPlayerControls(state)}
` } function renderMedia (state) { if (!state.server) return // Unfortunately, play/pause can't be done just by modifying HTML. // Instead, grab the DOM node and play/pause it if necessary var mediaType = state.playing.type /* 'audio' or 'video' */ var mediaElement = document.querySelector(mediaType) /* get the