module.exports = Player var Bitfield = require('bitfield') var prettyBytes = require('prettier-bytes') var zeroFill = require('zero-fill') var hx = require('../lib/hx') var TorrentSummary = require('../lib/torrent-summary') 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)}
` } // Handles volume change by wheel function handleVolumeWheel (e) { dispatch('changeVolume', (-e.deltaY | e.deltaX) / 500) } 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 // Get the