diff --git a/lib/homepage.dart b/lib/homepage.dart index 2388a5897e3dc1853680b643311bb39ea2ade7fc..68f8585d6c8f5ea45b874046c772e96f12dfc4bb 100644 --- a/lib/homepage.dart +++ b/lib/homepage.dart @@ -219,6 +219,7 @@ class HomePage extends StatelessWidget { Future<void> checkIfAppIsActive(BuildContext context) async { + try { var isActive = await SpotifySdk.isSpotifyAppActive; final snackBar = SnackBar( diff --git a/lib/moodpage.dart b/lib/moodpage.dart index ec93c4cdcc7a6a8ff7ec608c710f42caf05dfaf7..187fadc64264fc5a9e76d99833de76b9661a46b7 100644 --- a/lib/moodpage.dart +++ b/lib/moodpage.dart @@ -1,6 +1,7 @@ import 'dart:ffi'; import 'dart:io'; import 'package:ambient/firebase.dart'; +import 'package:ambient/services/spotify.dart'; import 'main.dart'; import 'package:vector_math/vector_math.dart'; @@ -74,10 +75,12 @@ class MoodPage extends State<StateMoodPage> { } //sendet den befehl music zum passenden genre rauszusuchen _changeMusic() async { + Spotify spotify = Spotify(); + //code zum musik ändern String hexcode = selectedMood.red.toRadixString(16) + selectedMood.green.toRadixString(16) + selectedMood.blue.toRadixString(16); String genre = await changeFirebase().getGenreByHex(hexcode); print("genre = " + genre); - //playGenre(); + spotify.playGenre(genre); } //vergleicht zwei farben auf ähnlichkeit _getColorDistance(Color c1, Color c2) {