Search Unity

Radio PRO - MP3 and OGG-streaming solution

Discussion in 'Assets and Asset Store' started by Stefan-Laubenberger, Jun 18, 2015.

  1. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    What do you mean by "not working"? Have you created the project, made the changes and deployed the APK on a device? What happens then; does it play as long as it's in the foreground but stops in the background?

    What is your Android and Unity version?
     
  2. robbus1st

    robbus1st

    Joined:
    Jul 23, 2013
    Posts:
    13
    Yes i do export the unity project to android project. Then command the pause in the UnityPlayerActivity.java . build android project using android studio to apk. Redmi note 4. Using Unity 2019.1.13f
     
  3. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Ok, but Radio plays when it's in the foreground?
    .
    What is your Android-version? Have you tried it on other Android devices?
    Also important: what is the Radio-version?
     
  4. robbus1st

    robbus1st

    Joined:
    Jul 23, 2013
    Posts:
    13
    yes the radio run in foreground, but when screen off the radio is pause. redmi note 4 android version 7.0. oh yeah not yet because I'm don't have any devices. i'm using Radio Version: 06.12.2019.
     
  5. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    I just did a test with Radio 2020.1.0, Unity 2019.2.11 and Android 9; on my side background playback works.

    Unfortunately, I don't know why it doesn't work on your device - please try it with another device and use a similar setup like mine.
     
    robbus1st likes this.
  6. blake_seow

    blake_seow

    Joined:
    Aug 3, 2012
    Posts:
    15
    Hi, We have a problem running your newest version plugin in Unity2018.3.9.f1.
    We imported your plugin into a empty new project, then tested with "01-PlayStations" scene in your demo folder.
    Every time we hit the play button, After music played for 3~5 seconds, it always got broken with a error like this:

    1.FM - Cafe Radio
    Could not read audio after 0:04! This is typically a sign of a buffer underun -> Please try to increment the 'ChunkSize' and 'BufferSize':
    System.ArgumentException: Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
    at System.Buffer.BlockCopy (System.Array src, System.Int32 srcOffset, System.Array dst, System.Int32 dstOffset, System.Int32 count) [0x00097] in <d7ac571ca2d04b2f981d0d886fa067cf>:0
    at Crosstales.Radio.RadioPlayer.readPCMData (System.Single[] data) [0x000c8] in E:\illusion\DHH_AI4\UnityProject\AssetCollection\Assets\Plugins\crosstales\Radio\Scripts\RadioPlayer.cs:801
    UnityEngine.Debug:LogError(Object)
    Crosstales.Radio.RadioPlayer:logDataError(Exception) (at Assets/Plugins/crosstales/Radio/Scripts/RadioPlayer.cs:1115)
    Crosstales.Radio.RadioPlayer:readPCMData(Single[]) (at Assets/Plugins/crosstales/Radio/Scripts/RadioPlayer.cs:813)
    UnityEngine.AudioClip:InvokePCMReaderCallback_Internal(Single[])



    Then we tried double the ChunkSize and BufferSize, it made the music be able to played longer, like 6~10 seconds, but same error broke it after that.

    Please help us, Thanks!
     
    Last edited: Feb 20, 2020
  7. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hi

    We have to verify this, so please tell me more:
    1. What's the exact Radio version?
    2. Does it happen with every station?
    3. What's your development OS?
    4. Is it happening in the builds and Editor?

    So long,
    Stefan
     
    Last edited: Feb 20, 2020
  8. L_DravenGames

    L_DravenGames

    Joined:
    Apr 16, 2014
    Posts:
    31
    Hi friend, its an amazing asset but I´m having problems running in background with Android.

    I followed the steps of the documents, I deleted onPause in Android Studio and when I send the app to background, itworks, but when I back the app from background, the app crashes and I need restart de app.

    Please, any help with this??

    Thanks in advance
     
  9. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hi

    Have you added the "BGController" to your scene?
    You should add all objects from the hierarchy except the "RadioPlayer", like in our demo scenes:
    upload_2020-3-20_12-36-10.png

    Does that help?


    So long,
    Stefan
     

    Attached Files:

  10. L_DravenGames

    L_DravenGames

    Joined:
    Apr 16, 2014
    Posts:
    31
    Hi again friend!

    Yes! I have it!

    But nothing, In the device, I put the app in bg and the radio station cotinues woking, but going to background apps and I tap again to put the app again in front, the app stops (but not dissapear from the background apps menu) and I need to tap again and the app is restarted automatically.

    Its a Huawei device with android 9 without root.

    I will try later in a samsung s6 device to make the same test and check.

    I don´t know what's happening :-(

    Best.

    upload_2020-3-20_14-3-13.png
     
  11. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Please try it with the Samsung and let me know the result.

    Just to clarify: the whole "running in background"-thing is quite hacky; Unity is not designed to run apps in the background on mobile, but we found a way to force the app being kept alive.
    This has the disadvantage that it won't run on all devices and operation system versions. There are various parameters responsible for a seamless operation. For example, if there are multiple apps running at the same time, the os could decide to kill any app in the background.
    It also depends on your game: are there any other threads running etc.

    Therefore, we can't (and never claimed to) guarantee that it will work in the background on all mobiles. If you need an app that integrates with the os (like notification, controls in the lock-screen) and uses less resources (ram, cpu, battery), you will end up using a native solution anyway.
     
  12. L_DravenGames

    L_DravenGames

    Joined:
    Apr 16, 2014
    Posts:
    31
    Thanks a lot friend!

    In the Samsung S6 looks like works correctly, I dont know if the propblem is for the HUAWEI model or the Android 9 eheheh.

    Is not a game really, its a radio player directly pointing always to the same radio station and I only want to keep it in backgroudn for the people can continue listening it while doing another stuff or simply put the screen off.

    Best and thanks again.
     
    Stefan-Laubenberger likes this.
  13. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hello again my friend

    The issue you're having seems like it's not the fault of our "Radio" asset.
    Would you mind updating your review accordingly? ;)

    Thank you very much and stay safe!


    Cheers
    Stefan
     
  14. L_DravenGames

    L_DravenGames

    Joined:
    Apr 16, 2014
    Posts:
    31
    Sure!

    Done!
     
    Stefan-Laubenberger likes this.
  15. L_DravenGames

    L_DravenGames

    Joined:
    Apr 16, 2014
    Posts:
    31
    Thanks for the update friend, one question, do you know if there is any way to get the current song cover//image to show ??

    Even if is possible to get a list of all the previous songs played before you start the station? I mean, if you start the station in the song X, there is any way to get the 10 previous tracks info that has been played but you didnt listened? (is to fill a list with the last 10 played songs in the station)

    Thanks in advance.

    Best.
     
    Last edited: Mar 30, 2020
  16. L_DravenGames

    L_DravenGames

    Joined:
    Apr 16, 2014
    Posts:
    31
    And another question:

    It´s possible that when you Stop the radio and Play again, the same record info is added to the playedrecords list??

    I mean, if I am listening the song X and stop the radio and the play again before the song end, if I check the PlayedRecords this song can appear 2-3-4...n times depending how many times I stopped and played again during the same song?

    Thanks again.

    Best.
     
  17. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hi

    It's currently not possible to get the cover and last songs of a station, BUT we're working on an update for a large online radio service which will provide all you could ever think of ;-)
    The update will be released in April!

    Meanwhile, some stations deliver the url for the current song etc.; this can be found in the "RadioStation.ServerInfo".

    The second point about adding multiple times the same record: that's an issue and will be fixed in the next release.


    Cheers
    Stefan



    Edit:
    @L_DravenGames We have fixed the issue from your last post. If you like an update to the latest version, please send us an email.
     
    Last edited: Mar 31, 2020
  18. L_DravenGames

    L_DravenGames

    Joined:
    Apr 16, 2014
    Posts:
    31
    Done!

    Thanks friend!
     
  19. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
  20. robbus1st

    robbus1st

    Joined:
    Jul 23, 2013
    Posts:
    13
    when i update to new version in ios or android get freeze . then i debug read like this "No more data to read after 1:09! Please restart this station or choose another one." do any solve this??

    thanks.
     
  21. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hi

    That should not happen and I just verified it with our latest Android build; it goes on and on ;)
    Android

    Can you please answer some questions:
    1. What's your Unity version?
    2. Android version?
    3. Radio version?
    4. Stream url?

    So long,
    Stefan
     
  22. robbus1st

    robbus1st

    Joined:
    Jul 23, 2013
    Posts:
    13
    Hi, thank for respon
    1. What's your Unity version? On iOS using unity v 2019.1.13f, on Android using unity v 2019.3.5f
    2. Android version? Android v9, iOS v13.4.1
    3. Radio version? 2020.1.4
    4. Stream url? see attachment
     

    Attached Files:

    Last edited: May 1, 2020
  23. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    I've just tested it with my Android 9 phone and our demo (scene 03-PlayOwnStation).
    As you can see in the screenshot, it works:
    Screenshot_20200502-091003.png



    But we have other settings for the "RadioPlayer"; would you mind testing those:
    upload_2020-5-2_9-33-23.png

    Please let me know if it works.
     
  24. robbus1st

    robbus1st

    Joined:
    Jul 23, 2013
    Posts:
    13

    tq for reply. its work but when i'm play 1-3 minute Running Radio in the Background, the radio/ apps quit then not playing again. when i check log :

    No more data to read after 1:02! Please restart this station or choose another one.


    Crosstales.Radio.RadioPlayer:logNoMoreData()

    Crosstales.Radio.RadioPlayer:readPCMData(Single[])

    UnityEngine.PCMReaderCallback:Invoke(Single[])

    .

    can i handle this? and this just happen on ios and android.
     
    Last edited: May 15, 2020
  25. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hello again

    If you use the "SimplePlayer", there are settings for that case:
    upload_2020-5-15_20-25-56.png

    If you encounter those buffer under runs, please consider increasing the "Buffer Size" of the station.

    I hope this helps you further.


    Cheers
    Stefan
     
  26. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    We've just released version 2020.2.1 of Radio.
    Main changes:
    • Integration for OnRadio added
    • 300 new radio stations added
    • "LoadIcon"-class improved
    • "IconUrl" added to "RecordInfo" and "RadioStation"
    • RadioFilter: "Limit" added
    • All demo scenes improved
    • Updated to Common 2020.2.0

    Some impressions:
    CT_Screenshot_02-06-2020-19-30-41-7.png CT_Screenshot_02-06-2020-20-36-12-6.png
     
  27. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Awesome work, thanks for the update Stefan.
     
    Stefan-Laubenberger likes this.
  28. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Thank you for the compliment!
    If you like our asset, don't forget tor write a review - it's very much appreciated!
     
  29. robbus1st

    robbus1st

    Joined:
    Jul 23, 2013
    Posts:
    13
    I have an error when update to 2020.3.0 . i'm using Unity 3D 2019.3.5f1
     

    Attached Files:

  30. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
  31. GalleryWhitte

    GalleryWhitte

    Joined:
    Jan 23, 2017
    Posts:
    10
    Hi
    I downloaded the latest version for a new project.
    (With my older projects the asset worked fine)

    Today I got two Errors:
    Assets\Plugins\crosstales\Radio\Demos\Scripts\GUIPlayStation.cs(16,78): error CS0246: The type or namespace name 'OnRadio' could not be found (are you missing a using directive or an assembly reference?)
    and
    Assets\Plugins\crosstales\Radio\Demos\Scripts\TestAllStations.cs(14,14): error CS0246: The type or namespace name 'OnRadio' could not be found (are you missing a using directive or an assembly reference?)

    reinstalled etc.
    tx
     
  32. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hi

    I apologize for the hassle, but you have to install the "OnRadio"-package from the "3rd party"-folder.
    This is fixed in the next release.


    Cheers
    Stefan
     
    Last edited: Aug 3, 2020
  33. GalleryWhitte

    GalleryWhitte

    Joined:
    Jan 23, 2017
    Posts:
    10
    thx a lot.
    great asset

    :)
     
    Stefan-Laubenberger likes this.
  34. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi Stefan,

    I created a new project in Unity 2020.1.1f1 imported latest Radio Pro (Version 2020.3.0 - July 05, 2020), but it doesn't work :( I get this errors:
    Screen-Shot-2020-08-06-at-20.11.35.png
     
  35. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hi

    Have you imported "UI.unitypackage" from the "Common"-folder?
    You also need to import "OnRadio.unitypackage" from the "3rd party"-folder.
    This will be streamlined in the next version to produce less hassle for the demo scenes.


    Cheers
    Stefan
     
  36. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi @Stefan-Laubenberger ,
    I updated to the latest version today, everything works like a charm, great features really appreciate the new integrations.
    P.S: I reviewed the Radio Pro on the asset store!
     
    Stefan-Laubenberger likes this.
  37. Nesit

    Nesit

    Joined:
    Dec 24, 2019
    Posts:
    8
    Hi @Stefan-Laubenberger
    I'm looking to purchase your asset, but before that, I try to set up our local streaming radio and use it within the demo (on android, if it matters, even though I aim for iOS build).
    Basically we try various streaming protocols. Icecast or Shoutcast seem to be the easiest way (even though it didn't work at first, but we really didn't dig into it much), but I want to see if using RTMP or HLS is possible at all (due to server's performance limitations).
    RTMP seems to be not supported, okay.
    But what about HLS, basically playing from m3u/m3u8 playlist, is that supported? Like, does it support video streams, aka youtube (but I'll use audio only). I know how to extract m3u8 url from youtube page, but it's kinda problematic to see if it works in demo version.

    Thanks in advance.

    P.S.I can't launch Mac OS demo for some reason, is that broken?
     
  38. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hi Nesit

    Thank you for your interest in Radio!

    Radio works great with Shoutcast or Icecast servers.
    It contains no support for RTMP nor HLS, but you can try it in our demo scene "PlayOwnStation".

    About the issue on macOS (see README.md"):
    I hope this helps you further.


    Cheers
    Stefan
     
  39. Legendary_keith

    Legendary_keith

    Joined:
    Apr 21, 2015
    Posts:
    20
    Hi Stefan,

    I have some errors in script GuiRadioPlayer (139,39),(145,39),(157,40),(163,40) and GUIPlayStation (200,40), (206,40).
    It says that a property or indexer may not be passed as an out or ref parameter.

    How can I make these errors disappear?

    Edit: Nevermind, I fixed it by putting Player.Filter.Ratingmin in a new float variable.
     
    Last edited: Nov 27, 2020
    Stefan-Laubenberger likes this.
  40. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    We've just released version 2020.4.9 of Radio.
    Main changes:
    • Planned final release for 2020
    • New Youtube video added:
    • Updated to Common 2020.4.7
     
  41. phongle669455

    phongle669455

    Joined:
    Jun 10, 2018
    Posts:
    7
    Hi, I've been looking at Turbo Switch Pro for a long time. Finally pulled the trigger because of the sale. Now I'm looking at your suite of tools and regarding this one. I understand that this plays songs from online (radio channels?). I am wondering what the legality of this asset would be to put into a game.
     
  42. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hi

    Thank you for investing into Turbo Switch!

    About "Radio": we are convinced that's absolutely legal to use Radio stations in your product - all the revenue from ads goes to them.
    It's imho also important to provide the information of the current station to the users of your app. This way, they can "become fans" and maybe listen to it outside of the app :)

    We wrapped this up in chapter 12 of the documentation:
    https://www.crosstales.com/media/data/assets/radio/Radio-doc.pdf

    I hope this helps you further.

    Have a nice weekend!


    Cheers
    Stefan
     
    Last edited: May 10, 2022
    phongle669455 likes this.
  43. scottieo

    scottieo

    Joined:
    May 31, 2017
    Posts:
    5
    Stefan, this asset is amazing!

    Is there a good way to have the Radio Pro assets survive a scene switch but ensure no duplication? My game involves scene switching including switching back to scenes the player has already been in. I'm using the SurviveSceneSwitch assets but I'm noticing this is causing the Radio Pro assets to duplicate when I scene switch back to scenes I've already been in.

    Thanks!
    Scott
     
  44. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hi Scott

    Thank you for your kind words!

    What happens if you add the "RadioPlayer" to the "SurviveSceneSwitch" as child?


    So long,
    Stefan
     
    scottieo likes this.
  45. scottieo

    scottieo

    Joined:
    May 31, 2017
    Posts:
    5
    It looks like it worked, I have to play around with it a little more so I'll comment back if anything comes up but yes it looks good! Thank you so much!

     
    Stefan-Laubenberger likes this.
  46. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    You're welcome!
    If you like our asset/support and have some spare time left, please write a review - it always makes us happy :)
     
  47. scottieo

    scottieo

    Joined:
    May 31, 2017
    Posts:
    5
    I played around with the Radio Pro asset and get it persistently working across scene changes, including when I return to scenes I've already been in. Thank you for your help so far!

    I'm having an issue with the Radios_user.txt file.
    In Unity play mode, when I switch to a different scene and then switch back to the original scene, then exit play mode, Radios_user.txt deletes all the radio stations from it. If I'm in play mode and don't switch scenes or only switch scenes once, the radio stations aren't deleted. Maybe there is a checkbox I'm missing that causes the asset to reset the file? Here's a picture of the setup I have in Unity.

    upload_2021-1-22_16-5-16.png
     
  48. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hmm, this is a bit strange, your settings look correct.
    However, what happens, if you use the "RadioProviderUserFavorites" from the "Topsongs" (under "OnRadio") and add it as additional provider?
    upload_2021-1-23_22-59-20.png

    Cheers
    Stefan
     
  49. scottieo

    scottieo

    Joined:
    May 31, 2017
    Posts:
    5
    Ok thanks for the suggestion, I gave that a try but it resulted in the Radios_favorites.txt also erasing all of the radio stations each time.

    I found a solution by unchecking "Save On Disable" on RadioProviderUser in the hierarchy. The problem was only happening when I scene switch and then try to change stations and scene switch back, it wasn't happening when I scene switch and scene switch back without changing stations. So maybe when I changed songs after scene switch the asset thought there weren't any stations in the playlist anymore and then it overwrote the Radios_user.txt file with 0 entries? Unsure, but at least everything seems to be working now. I'll let you know if I run into other issues, thank you so much for the help!
     
    Stefan-Laubenberger likes this.
  50. WsdServers

    WsdServers

    Joined:
    Jan 28, 2017
    Posts:
    15
    Dear Stefan,

    I have upgraded to the latest version, and for some reason, it doesn't work in my project. The radio connects but plays only the first 1,2 second or such.
    Importing it to an empty project is all ok, do you have any idea, what can cause it doesn't work in my old project?