2022-07-27 22:32:12 +00:00
|
|
|
export const state = () => ({
|
|
|
|
loop: null,
|
2022-07-28 03:14:57 +00:00
|
|
|
speed: 1,
|
|
|
|
speedAutosave: null,
|
2022-07-27 22:32:12 +00:00
|
|
|
preload: null,
|
2022-07-29 04:44:26 +00:00
|
|
|
preloadUpTo: 100,
|
2022-07-28 20:20:18 +00:00
|
|
|
// quality: null,
|
2022-07-27 22:32:12 +00:00
|
|
|
// qualityAutoSwitch: null,
|
|
|
|
// shortFullscreen: null,
|
|
|
|
// autoplay: null,
|
|
|
|
// shorts: null,
|
|
|
|
// music: null,
|
|
|
|
});
|
|
|
|
export const mutations = {
|
2022-07-28 20:20:18 +00:00
|
|
|
initPlayer(state) {
|
|
|
|
if (process.client) {
|
|
|
|
state.loop = JSON.parse(localStorage.getItem("loop")) === true; // defaults to false
|
|
|
|
state.speed = JSON.parse(localStorage.getItem("speed")) || 1; // defaults to 1
|
|
|
|
state.speedAutosave = !(
|
|
|
|
// false if false, defaults to true
|
|
|
|
(JSON.parse(localStorage.getItem("speedAutosave")) === false)
|
|
|
|
);
|
|
|
|
state.preload = JSON.parse(localStorage.getItem("preload")) === true; // defaults to false
|
2022-07-29 04:44:26 +00:00
|
|
|
state.preloadUpTo =
|
|
|
|
JSON.parse(localStorage.getItem("preloadUpTo")) || 100; // defaults to 100(percent)
|
2022-07-28 20:20:18 +00:00
|
|
|
}
|
|
|
|
},
|
2022-07-27 22:32:12 +00:00
|
|
|
setLoop(state, payload) {
|
|
|
|
state.loop = payload;
|
2022-07-28 20:20:18 +00:00
|
|
|
localStorage.setItem("loop", payload);
|
2022-07-27 22:32:12 +00:00
|
|
|
},
|
|
|
|
setSpeed(state, payload) {
|
2022-07-28 03:14:57 +00:00
|
|
|
state.speed = payload;
|
2022-07-28 20:20:18 +00:00
|
|
|
localStorage.setItem("speed", payload);
|
2022-07-28 03:14:57 +00:00
|
|
|
},
|
|
|
|
setSpeedAutosave(state, payload) {
|
|
|
|
state.speedAutosave = payload;
|
2022-07-28 20:20:18 +00:00
|
|
|
localStorage.setItem("speedAutosave", payload);
|
2022-07-27 22:32:12 +00:00
|
|
|
},
|
|
|
|
setPreload(state, payload) {
|
|
|
|
state.preload = payload;
|
2022-07-28 20:20:18 +00:00
|
|
|
localStorage.setItem("preload", payload);
|
2022-07-27 22:32:12 +00:00
|
|
|
},
|
2022-07-29 04:44:26 +00:00
|
|
|
setPreloadUpTo(state, payload) {
|
|
|
|
state.preloadUpTo = payload;
|
|
|
|
localStorage.setItem("preloadUpTo", payload);
|
|
|
|
},
|
2022-07-27 22:32:12 +00:00
|
|
|
};
|