Increase/Decrease Sound with mouse wheel on video

This commit is contained in:
Rolando Guedes
2016-05-12 15:09:01 +01:00
parent 2b8c1fe709
commit ed1b27ede0

View File

@@ -10,14 +10,21 @@ var Bitfield = require('bitfield')
var TorrentSummary = require('../lib/torrent-summary')
var {dispatch, dispatcher} = require('../lib/dispatcher')
// Handles volume change by wheel
var handleVolumeWheel = function (e) {
dispatch('changeVolume', (-e.deltaY | e.deltaX) / 500)
};
// 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'
var showVideo = state.playing.location === 'local';
return hx`
<div
class='player'
onwheel=${handleVolumeWheel}
onmousemove=${dispatcher('mediaMouseMoved')}>
${showVideo ? renderMedia(state) : renderCastScreen(state)}
${renderPlayerControls(state)}
@@ -447,11 +454,6 @@ function renderPlayerControls (state) {
dispatch('playbackJump', position)
}
// Handles volume change by wheel
function handleVolumeWheel (e) {
dispatch('changeVolume', (-e.deltaY | e.deltaX) / 500)
}
// Handles volume muting and Unmuting
function handleVolumeMute (e) {
if (state.playing.volume === 0.0) {