yt-audio-player

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

player.ts (716B)


      1 import { ref } from 'vue';
      2 
      3 export interface Queue {
      4     video_id: string;
      5     title: string;
      6 };
      7 
      8 let queue: Queue[] = [];
      9 const isPlaying = ref(false);
     10  
     11 function add_to_queue(list: Queue[]): void {
     12     console.log("add_to_queue was called");
     13     for (let i = 0; i < list.length; i++) {
     14         queue.push(list[i]);
     15     };
     16 }
     17  
     18 function remove_queue(): void {
     19     console.log("remove_queue was called");
     20     queue = [];
     21 }
     22  
     23 function next_song(): void {
     24     console.log("next_song was called");
     25     queue.shift();
     26 }
     27  
     28 function toggle_play(): void {
     29     console.log("play_pause was called");
     30     isPlaying.value = !isPlaying.value;
     31 }
     32 
     33 
     34  
     35  export default {add_to_queue, remove_queue, next_song, toggle_play, isPlaying};