module.exports = Player var h = require('virtual-dom/h') var hyperx = require('hyperx') var hx = hyperx(h) var util = require('../util') // Shows a streaming video player. Standard features + Chromecast + Airplay function Player (state, dispatch) { // 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`
dispatch('mediaMouseMoved')}> ${showVideo ? renderMedia(state, dispatch) : renderCastScreen(state, dispatch)} ${renderPlayerControls(state, dispatch)}
` } function renderMedia (state, dispatch) { 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