Fix: Videos start muted on initial session

## Issue
4831: Videos start muted on Desktop (fresh install) and web (sometimes resets)

This covers the Desktop fresh install and Web fresh session (incognito) part. It doesn't cover the "sometimes reset" part as I don't know how to reproduce that.

## Change
`sessionStorage` is always empty when that piece of code is called, even for non-fresh Desktop and even in Brave. We now fallback to `1` when `volume` is `null`. Still not sure the purpose of that code, but leaving it there just in case something relies on it.

## Tests
[/] Desktop fresh-install is not muted.
[/] Desktop return session restores previous volume level.
[/] Web* fresh session (cleared data) is not muted.
[/] Web return session restores previous volume level.

*Web = Chrome, Firefox and Brave.
This commit is contained in:
infiinte-persistence 2020-10-07 10:14:20 +08:00 committed by Sean Yesmunt
parent d2396b674e
commit 4a2e9bf1c7

View file

@ -85,7 +85,7 @@ const defaultState: AppState = {
// @@router comes from react-router
// This action is dispatched any time a user navigates forward or back
try {
defaultState.volume = Number(sessionStorage.getItem('volume'));
defaultState.volume = Number(sessionStorage.getItem('volume') || 1);
} catch (e) {}
reducers['@@router/LOCATION_CHANGE'] = (state, action) => {