Skip to content

Commit

Permalink
Fixed loading of deeplink playlist #198
Browse files Browse the repository at this point in the history
  • Loading branch information
anandnet committed Apr 15, 2024
1 parent dee90cc commit eb7efad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/services/music_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,8 @@ class MusicServices extends getx.GetxService {
final data = Map.of(_context);
data['videoId'] = songId;
final response = (await _sendRequest("player", data)).data;
final videoDetails = response["videoDetails"];
if (videoDetails.containsKey("musicVideoType")) {
final category = nav(response, ["microformat","microformatDataRenderer", "category"]);
if (category == "Music" || (response["videoDetails"]).containsKey("musicVideoType")) {
final list = await getWatchPlaylist(videoId: songId);
return [true, list['tracks']];
}
Expand Down
11 changes: 7 additions & 4 deletions lib/utils/app_link_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:app_links/app_links.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '/utils/helper.dart';
import '../ui/widgets/loader.dart';
import '/services/music_service.dart';
import '/ui/player/player_controller.dart';
Expand Down Expand Up @@ -43,10 +44,11 @@ class AppLinksController extends GetxController {

if (uri.host == "youtube.com" ||
uri.host == "music.youtube.com" ||
uri.host == "youtu.be" || uri.host == "www.youtube.com") {
//printINFO("pathsegmet: ${uri.pathSegments} params:${uri.queryParameters}");
uri.host == "youtu.be" ||
uri.host == "www.youtube.com") {
printINFO("pathsegmet: ${uri.pathSegments} params:${uri.queryParameters}");
if (uri.pathSegments[0] == "playlist" &&
(!uri.queryParameters.containsKey("playnext") || uri.host == "music.youtube.com")) {
uri.queryParameters.containsKey("list")) {
final browseId = uri.queryParameters['list'];
await openPlaylistOrAlbum(browseId!);
} else if (uri.pathSegments[0] == "shorts") {
Expand All @@ -59,7 +61,8 @@ class AppLinksController extends GetxController {
} else if (uri.pathSegments[0] == "channel") {
final browseId = uri.pathSegments[1];
await openArtist(browseId);
} else if ((uri.queryParameters.isEmpty || uri.query.contains("si=")) && uri.host == "youtu.be") {
} else if ((uri.queryParameters.isEmpty || uri.query.contains("si=")) &&
uri.host == "youtu.be") {
final songId = uri.pathSegments[0];
await playSong(songId);
}
Expand Down

0 comments on commit eb7efad

Please sign in to comment.