Android mediaplayer setdatasource - android

I have a tricky question regarding the MediaPlayer class.
I would like to find a way to play MORE than ONE online song. I though of doing it with soundcloud, but clearly the website of a playlist will not work out.
Therefore I thought of adding several string referring to single songs on soundcloud by deploying the ".setDataSource" but the app crashes, aka I cant have more than one string.
Hence, I tried with only one, but the single song's page from SoundCloud does not work either. Apparently it only works with online mp3.
Now, getting online .mp3 lawfully is rather hard nowadays and I was looking for a way to play mp3 (or m3u) from an authorised website or possibly even a playlist.
Any ideas?

Use the Google's ExoPlayer , its powerful, flexible and supports adaptive streaming. You can get to know more about it in here, also the github page.

Related

Can I access the youtube player from external android app and get currently playing video ID and exact playing position?

Do you know, whether it is possible to access the YouTube player on a mobile phone from a self-developed android/iPhone App? In order to get the information, which video the user currently watches, and also the exact time-stamp of the played video at that moment? Is this possible?
Of course, assuming that the user would have explicitly allowed accessing this information before.
Or is Youtube running too much in its own “sandbox” and not accessible from other apps?
I was reading e.g.
Programmatically get Current Playing YouTube Video
including the answers, and am afraid that this is not possible - since I would need even more: the playing position.
If such external access of the youtube player is not possible, what could be an alternative? To provide an own, newly programmed, standalone youtube player within our app, which then would have no problems accessing such information? If so, does any one have a recommendation for a tool / tutorial that could show me, how to build such an app?
I appreciate any hints and comments!
Best regards,
Matthias

Youtube Music API for Uploaded music

Problem:
Youtube Music sucks for playing back music you have uploaded for years. The app sucks, and the Android Auto app sucks. I've contacted the YT Music team many times, but they don't seem to listen to music ever so they don't even understand the problem(s).
Solution:
Create my own app to play back my own music that lives in Google/Youtube Music. I'm an Android app developer so might as well fix this my own way.
Are there APIs for Youtube Music? I know there's an unofficial Youtube Music API, but that's phython, it doesn't build at the moment (Feb 2022), and it seems to focus on paid music, not my own uploaded library.
Would Google drive APIs do this? If so, is there documentation on how to use it? I can figure out the OAuth part, but I don't know where to get the data for the parameters in this sample api
Is there a better way for this? I just need to download the music files, and then create a player around them.
Thank you!
I was looking for something similar but the closest I got was ytmusicapi in python. It works for me and I installed it via pip install ytmusicapi. Its source is hosted on https://github.com/sigma67/ytmusicapi there, perhaps, you can see the YTM protocol. Authentication works by simply copying cookies from your browser after authenticating with YTM manually. That worked for me as well.
Another option is Kodi and a plugin they have: https://forum.kodi.tv/showthread.php?tid=360827 (but that did not seem to work for me after 3 minutes I spent on it).
If you are serious about it and you can't get YTM protocol via the source of ytmusicapi, then you can perhaps reverse-engineer the protocol using your browser. Firefox's Tools->Browser Tools->Web Developer Tools is your best friend. After you authenticate to YTM, open the "tools", click on "Library" on YTM webpage, then in "tools" tab, go to Network and look for a POST similar to https://music.youtube.com/youtubei/v1/browse?key=... right click on it and Copy->Copy as Curl. You will be able to see what auth-headers it sends and also what's the protocol for showing up your YTM Library.

retrive only mobile-supported video from YouTube API

I'm using the YouTube API to retrieve videos for and Android client.
The program works well but sometimes I get an error like "this video is not allowed to run on smartphones".
So, there is a way to filter that videos? I read this doc but did not find a solution.
There are two concepts embeddable and syndicated.
iOS devices use iframe so they basically embed.
Android devices that use player API can check syndicated.
When you do a search->list, you can set videoEmbeddable and videoSyndicated to true.
For Android, you should check videoSyndicated.
Or if you are iterating through videos, for each video, you can do a video->list call with video id and check status.embeddable in the response.
Here is a blog post about this topic, even though examples are in v2, information is still relevant.

Detecting Spotify Song Plays

I'm working on a mobile application that detects song plays from various media players, both on iPhone and Android. We currently support a number of applications in both platforms. Our application works in a similar way to how Last.FM detects and automatically scrobbles plays.
However, we have not been able to get a working solution for detecting Spotify song plays that does not need to use either Last.FM scrobbling (available in Spotify for Android only) or Facebook as a proxy.
I've tried a few things for android but as I understand it (I see lots of posts e.g. Find what song is playing in spotify on android), the Android Application does not broadcasts media related intents for song plays, so we need something more creative. In any case this does not solve our problem for the iPhone use case.
Lib-spotify held some promise for us, and I've manged to build an application that can create a session and navigate some playlists, but I have not figured out if I can load what would appear as "play history" in the Desktop Application via lib-spotify (e.g. is this a special form of playlist?). I have also tried a Spotify App to accomplish the same but the API appears to not to expose required functionality.
It seems like I've exhausted all avenues on this one, but does anybody have any suggestions for something I haven't tried?
Assume that I have spotify credentials for each user whose history I would like to gather.
Thanks
Spotify has a metadatachanged intent-action that contains artist, album, track, length, and id values.
See: https://stackoverflow.com/a/22195867/1345586
Unfortunately, the desktop play history is local to each machine, meaning it can't be accessed through libspotify or any other API.
At the moment, there isn't a way to reliably achieve what you're wanting to do on mobile platforms.

The most adaptable way to play YouTube Video in android application

I did google about this question and I found 4 possible ways to do it:
play the video with the following manner:
startActivity(newIntent(Intent.ACTION_VIEW,Uri.parse(uri)));
Get the RTSP link and play the video with VideoView
play the video using Flash
Using HTML5 iframe
I have an android 4.0 device and I am able to play YouTube videos using the first three methods. My question is: which method is the most adaptable to different version. If the answer is using HTML5, how can I do it. Thank you very much for your time.
The most allround way of doing it to open it with a URI parse. There is also a way of forcing the YouTube app to be called(sorry I think I read it someplace but I do not remember how) and show the video there. This means you do not get the option to chose to open the video in the browser.
The rest of the alternatives are only supported by some devices. (Flash is outdated, HTML5 is not supported on most devices). I you are going to do something else then using the buildt-in YouTube app I would recomend RTSP as the best option.

Categories

Resources