Merge pull request #486 from rguedes/soundwheelvideo
Increase/Decrease Sound with mouse wheel on video hover
This commit is contained in:
@@ -10,6 +10,11 @@ var Bitfield = require('bitfield')
|
|||||||
var TorrentSummary = require('../lib/torrent-summary')
|
var TorrentSummary = require('../lib/torrent-summary')
|
||||||
var {dispatch, dispatcher} = require('../lib/dispatcher')
|
var {dispatch, dispatcher} = require('../lib/dispatcher')
|
||||||
|
|
||||||
|
// Handles volume change by wheel
|
||||||
|
function handleVolumeWheel (e) {
|
||||||
|
dispatch('changeVolume', (-e.deltaY | e.deltaX) / 500)
|
||||||
|
}
|
||||||
|
|
||||||
// Shows a streaming video player. Standard features + Chromecast + Airplay
|
// Shows a streaming video player. Standard features + Chromecast + Airplay
|
||||||
function Player (state) {
|
function Player (state) {
|
||||||
// Show the video as large as will fit in the window, play immediately
|
// Show the video as large as will fit in the window, play immediately
|
||||||
@@ -18,6 +23,7 @@ function Player (state) {
|
|||||||
return hx`
|
return hx`
|
||||||
<div
|
<div
|
||||||
class='player'
|
class='player'
|
||||||
|
onwheel=${handleVolumeWheel}
|
||||||
onmousemove=${dispatcher('mediaMouseMoved')}>
|
onmousemove=${dispatcher('mediaMouseMoved')}>
|
||||||
${showVideo ? renderMedia(state) : renderCastScreen(state)}
|
${showVideo ? renderMedia(state) : renderCastScreen(state)}
|
||||||
${renderPlayerControls(state)}
|
${renderPlayerControls(state)}
|
||||||
@@ -447,11 +453,6 @@ function renderPlayerControls (state) {
|
|||||||
dispatch('playbackJump', position)
|
dispatch('playbackJump', position)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handles volume change by wheel
|
|
||||||
function handleVolumeWheel (e) {
|
|
||||||
dispatch('changeVolume', (-e.deltaY | e.deltaX) / 500)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handles volume muting and Unmuting
|
// Handles volume muting and Unmuting
|
||||||
function handleVolumeMute (e) {
|
function handleVolumeMute (e) {
|
||||||
if (state.playing.volume === 0.0) {
|
if (state.playing.volume === 0.0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user