Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

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,526
    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:
    11
    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,526
    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:
    11
    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,526
    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:
    13
    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,526
    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,526
    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,526
    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,526
    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,526
    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,526
  20. robbus1st

    robbus1st

    Joined:
    Jul 23, 2013
    Posts:
    11
    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,526
    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:
    11
    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,526
    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:
    11

    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,526
    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,526
    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,340
    Awesome work, thanks for the update Stefan.
     
    Stefan-Laubenberger likes this.
  28. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,526
    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:
    11
    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,526
  31. GalleryWhitte

    GalleryWhitte

    Joined:
    Jan 23, 2017
    Posts:
    6
    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,526
    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:
    6
    thx a lot.
    great asset

    :)
     
    Stefan-Laubenberger likes this.
  34. InfinityCoder88

    InfinityCoder88

    Joined:
    Oct 4, 2013
    Posts:
    283
    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,526
    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. InfinityCoder88

    InfinityCoder88

    Joined:
    Oct 4, 2013
    Posts:
    283
    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:
    4
    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,526
    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. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,526
    We've just released version 2020.4.4 of Radio.
    Main changes:
    • RadioPlayer: global access via "Instance" added
    • Multi-threading improved
    • Updated to Common 2020.4.4
     
  40. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,526
    The new version is in the store!
     
unityunity