File tree Expand file tree Collapse file tree 5 files changed +43
-4
lines changed Expand file tree Collapse file tree 5 files changed +43
-4
lines changed Original file line number Diff line number Diff line change @@ -442,7 +442,7 @@ const preamp = computed({
442442 set : (value ) => {
443443 peq .value .preamp = value ;
444444 },
445- })
445+ });
446446
447447const removeBand = (index : number ) => {
448448 peq .value .bands .splice (index , 1 );
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ export const getPlayerMenuItems = (
3030 } ) ;
3131 }
3232 // add stop playback menu item
33- if ( player ?. state == "playing" ) {
33+ if ( player ?. state == "playing" || player ?. state == "paused" ) {
3434 menuItems . push ( {
3535 label : "stop_playback" ,
3636 labelArgs : [ ] ,
@@ -167,6 +167,34 @@ export const getPlayerMenuItems = (
167167 icon : "mdi-cancel" ,
168168 } ) ;
169169 }
170+
171+ // add 'select source' menu item
172+ const selectableSources = player . source_list . filter ( ( s ) => ! s . passive ) ;
173+ if (
174+ player . supported_features . includes ( PlayerFeature . SELECT_SOURCE ) &&
175+ ! player . synced_to &&
176+ selectableSources . length > 0
177+ ) {
178+ menuItems . push ( {
179+ label : "select_source" ,
180+ labelArgs : [ ] ,
181+ icon : "mdi-import" ,
182+ subItems : selectableSources
183+ . map ( ( s ) => {
184+ return {
185+ label : s . name ,
186+ labelArgs : [ ] ,
187+ action : ( ) => {
188+ api . playerCommandGroupSelectSource ( player . player_id , s . id ) ;
189+ } ,
190+ } ;
191+ } )
192+ . sort ( ( a , b ) =>
193+ a . label . toUpperCase ( ) > b . label ?. toUpperCase ( ) ? 1 : - 1 ,
194+ ) ,
195+ } ) ;
196+ }
197+
170198 // add 'don't stop the music' menu item
171199 if ( playerQueue && "dont_stop_the_music_enabled" in playerQueue ) {
172200 menuItems . push ( {
Original file line number Diff line number Diff line change @@ -1039,6 +1039,13 @@ export class MusicAssistantApi {
10391039 } ) ;
10401040 }
10411041
1042+ public playerCommandGroupSelectSource (
1043+ playerId : string ,
1044+ source : string ,
1045+ ) : Promise < void > {
1046+ return this . playerCommand ( playerId , "select_source" , { source } ) ;
1047+ }
1048+
10421049 // Play Media related functions
10431050
10441051 public playMedia (
Original file line number Diff line number Diff line change @@ -244,9 +244,12 @@ export enum PlayerFeature {
244244 VOLUME_MUTE = "volume_mute" ,
245245 PAUSE = "pause" ,
246246 SET_MEMBERS = "set_members" ,
247+ MULTI_DEVICE_DSP = "multi_device_dsp" ,
247248 SEEK = "seek" ,
248249 NEXT_PREVIOUS = "next_previous" ,
249- ENQUEUE_NEXT = "enqueue_next" ,
250+ PLAY_ANNOUNCEMENT = "play_announcement" ,
251+ ENQUEUE = "enqueue" ,
252+ SELECT_SOURCE = "select_source" ,
250253}
251254
252255export enum EventType {
Original file line number Diff line number Diff line change 659659 "all_players" : " All players" ,
660660 "all_groups" : " All groups" ,
661661 "no_player_playing" : " No players are currently playing" ,
662- "stop_playback" : " Stop playback"
662+ "stop_playback" : " Stop playback" ,
663+ "select_source" : " Select source"
663664}
You can’t perform that action at this time.
0 commit comments