starting audio player
This commit is contained in:
@@ -46,6 +46,11 @@
|
||||
<label id="library-directory-label">No Library Directory Selected</label>
|
||||
<button onclick="dirPicker()">Choose Directory...</button>
|
||||
</section>
|
||||
<section>
|
||||
<button onclick="onPlayPauseButtonClick()">
|
||||
<img src="/src/assets/images/icons/music/play-solid.svg" id="playPauseButtonIcon"/>
|
||||
</button>
|
||||
</section>
|
||||
</main>
|
||||
<footer></footer>
|
||||
</body>
|
||||
|
||||
+18
-1
@@ -1,8 +1,10 @@
|
||||
import './pico.css';
|
||||
import { DirectoryPicker, GetLibraryDir } from '../wailsjs/go/main/App';
|
||||
import { DirectoryPicker, GetLibraryDir} from '../wailsjs/go/main/App';
|
||||
import { Play } from '../wailsjs/go/player/Player';
|
||||
|
||||
|
||||
let libraryDirectoryLabel = document.getElementById("library-directory-label");
|
||||
let playPauseButtonIcon = document.getElementById("playPauseButtonIcon");
|
||||
|
||||
GetLibraryDir().
|
||||
then((result) => {
|
||||
@@ -10,6 +12,21 @@ GetLibraryDir().
|
||||
window.updateLibraryDirLabel(result);
|
||||
}).catch((err) => { console.error(err) })
|
||||
|
||||
window.onPlayPauseButtonClick = function() {
|
||||
try {
|
||||
Play().then((result) => {
|
||||
console.log(result)
|
||||
playPauseButton.setAttribute("src", "/src/assets/images/icons/music/pause-solid.svg")
|
||||
}).catch((err) => {
|
||||
console.log("There is an error with playing")
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
window.dirPicker = function() {
|
||||
var dir;
|
||||
try {
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
import {context} from '../models';
|
||||
|
||||
export function Init(arg1:context.Context):Promise<void>;
|
||||
|
||||
export function Play():Promise<void>;
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
export function Init(arg1) {
|
||||
return window['go']['player']['Player']['Init'](arg1);
|
||||
}
|
||||
|
||||
export function Play() {
|
||||
return window['go']['player']['Player']['Play']();
|
||||
}
|
||||
Reference in New Issue
Block a user