release
This commit is contained in:
@@ -12,10 +12,16 @@
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
background: transparent;
|
||||
}
|
||||
#player{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
opacity: 0;
|
||||
transition: .5s ease-in-out;
|
||||
object-fit: cover;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { invoke } from '@tauri-apps/api/core'
|
||||
interface Params{
|
||||
url?:string
|
||||
import { getCurrentWindow } from '@tauri-apps/api/window'
|
||||
interface Params {
|
||||
url?: string,
|
||||
mute?: string
|
||||
}
|
||||
function getSearchParamsAsObject() {
|
||||
const params = new URLSearchParams(window.location.search)
|
||||
@@ -10,22 +12,36 @@ function getSearchParamsAsObject() {
|
||||
})
|
||||
return paramsObject
|
||||
}
|
||||
const params:Params = getSearchParamsAsObject()
|
||||
if (params.url) {
|
||||
console.log(params.url)
|
||||
invoke('get_file', {
|
||||
path: params.url
|
||||
|
||||
window.onload = () => {
|
||||
invoke('set_wallpaper', {
|
||||
title: 'wallitor_video_playback'
|
||||
}).then((res) => {
|
||||
console.log(res)
|
||||
const binary_data_arr = new Uint8Array(res as number[])
|
||||
const blob = new Blob([binary_data_arr], { type: 'video/mp4' })
|
||||
const videoUrl = URL.createObjectURL(blob)
|
||||
const player = document.getElementById("player") as HTMLVideoElement;
|
||||
if(player) {
|
||||
player.src = videoUrl;
|
||||
player.play();
|
||||
player.muted = true;
|
||||
player.loop = true;
|
||||
if(!res) {
|
||||
console.error("Unable to set wallpaper.");
|
||||
const win = getCurrentWindow();
|
||||
win.destroy();
|
||||
return;
|
||||
}
|
||||
const params: Params = getSearchParamsAsObject()
|
||||
if (params.url) {
|
||||
invoke('get_file', {
|
||||
path: params.url
|
||||
}).then((res) => {
|
||||
const binary_data_arr = new Uint8Array(res as number[])
|
||||
const blob = new Blob([binary_data_arr], { type: 'video/mp4' })
|
||||
const videoUrl = URL.createObjectURL(blob)
|
||||
const player = document.getElementById('player') as HTMLVideoElement
|
||||
if (player) {
|
||||
player.src = videoUrl
|
||||
player.play()
|
||||
if(params.mute) {
|
||||
player.muted = JSON.parse(params.mute);
|
||||
}
|
||||
player.loop = true
|
||||
setTimeout(()=>{player.style.opacity = '1'},0);
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user