y20k / transistor

Transistor - Simple Radio App for Android
http://y20k.org/transistor/
MIT License
435 stars 122 forks source link

How to use player service in my project #356

Closed javaddeveloper closed 3 years ago

javaddeveloper commented 3 years ago

Hello and thank you for this great framwork

I am new in android developer and i created a simple radio application

now i only want to use core of stations player How can i find that specific code or function that get stations stream links and start to play it ?

y20k commented 3 years ago

I think your question is too broad to expect a satisfying answer. I will try to help you a bit, but I can only scratch the surface here in scope of this comment:

You might want to start by copying PlayerService.kt to your project. Then have a look at PlayerFragment.kt. This class is the starting point of the user interface. It connects to the PlayerService via a MediaBrowser. The user interface controls the playback via a PlayerController.kt. Playback can be started here via play(mediaId: String) (if you maintain a list of stations) or playStreamDirectly(streamUri: String) (if you want to play back a stream url directly).

But: If I were you I would start from scratch. Most of Transistor's code is not really portable / it is tailored specifically for the app. In any case you should have a look at UAMP. Although this is not a radio app, it may be a better project to help you to kickstart your own app. Better code, more portable.

Cheers :+1:

javaddeveloper commented 3 years ago

Thank you for answer Your answer can help me to create my own app

javaddeveloper commented 3 years ago

Hello my friend

I have try to play stream directly but after set link into this function playStreamDirectly(streamUri: String) not happening

I have copy all of your codes in my project

i think after lunch app, my app shuld start player session but i don't know how

Could you crete a portable code of your radio some mybe many developers looking for this portable radio framwork

y20k commented 3 years ago

Could you crete a portable code of your radio some mybe many developers looking for this portable radio framwork

Plain answer: No. That would be a huge undertaking. I simply do not have enough time (and expertise to be honest) to do that.

I encourage you to take a look at UAMP. This is a very well made demo app. https://github.com/android/uamp/blob/867373d9c0c189ac9e68fd967285cee70adcb106/docs/FullGuide.md

Depending on you approach UAMP may be a bit over the top. Maybe you want to start out with a Google Codelab about media streaming first. https://developer.android.com/codelabs/exoplayer-intro

Other interesting learning resources can be found here https://developer.android.com/guide/topics/media/additional-resources#samples