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,980
    Hi

    Android 9+ and iOS 10+ are only supporting URL's with the HTTPS-protocol.
    Your station is HTTP, which won't work.

    Please consider streaming your station over Shoutcast or Radionomy, which both support HTTPS.


    Cheers
    Stefan
     
  2. shubhank008

    shubhank008

    Joined:
    Apr 3, 2014
    Posts:
    107
    Is there any alternative or solution for non https or such ? That url/stream uses shoutcast but its owned/made by my father's friend who wanted a simple app for their radio station. Unfortunately the original dev who created it and set it up is no longer in touch and they do not have any access to its server or admin panel, etc.
     
  3. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,980
    Unfortunately, both mobile OS providers decided that HTTP is no longer "good/save" enough :(
    You have to use HTTPS for mobile nowadays.
    We can provide you some ideas on how-to start from scratch hosting your own station (if the original dev is no longer available).


    Cheers
    Stefan
     
  4. shubhank008

    shubhank008

    Joined:
    Apr 3, 2014
    Posts:
    107
    Does that include re-setting up a whole shoutcast server from scratch ? Problem is, I am pretty sure they no longer have access to their servers or current setup so that they can give me anything to re-setup or recreate a new server/shoutcast from.

    I do could set up shoutcast from scratch too but thing is their actual studio/equipment is borders apart and it seems the current setup is set to stream directly from their studio to that IP/url. TBH, I think redoing everything from scratch is gonna be just too much hassle and time taking.

    Instead, I am thinking of some middle ware "hack". Something like creating another middle layer of server with ffmpeg taking that http input and doing output on https, since I can configure my server to be https.

    Oh well, what a bummer. I will talk with him and see what he thinks. Its a bit hard to talk all this technical stuff to dads and their circles, especially in third world.
     
  5. Stefan-Laubenberger

    Stefan-Laubenberger

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

    That's unfortunate... You could try to redirect the stream under your own server via HTTPS. Something like:
    https://serverguy.com/security/redirect-http-to-https/

    But I'm not 100% if that would work.


    So long,
    Stefan
     
  6. behrouzb

    behrouzb

    Joined:
    Feb 14, 2018
    Posts:
    9
    Hello,

    We added this to our project and customized a bit, it works in the Editor, but doesn't work when run on my iPhone, what am I missing, what areas should I look at to debug this?
     
  7. Stefan-Laubenberger

    Stefan-Laubenberger

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

    I assume you are trying to connect to a station via IP or HTTP-only?
    iOS and Android 9+ are only working with HTTPS.


    Cheers
    Stefan
     
  8. behrouzb

    behrouzb

    Joined:
    Feb 14, 2018
    Posts:
    9
    Hi Stephan,

    We have the HTTPS flag set, so it is only pulling HTTPS links. What else do you think the issue could be? Would you be able to do a remote session to take a quick look? This works fine in the editor but not on my iphone!
     
  9. Stefan-Laubenberger

    Stefan-Laubenberger

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

    Sure, but right now I have to go to sleep :) Please join our Discord server for a session: https://discord.gg/ZbZ2sh4

    Meanwhile, can you please send me the log from Xcode? There must be a specific warning or error.


    So long,
    Stefan
     
  10. behrouzb

    behrouzb

    Joined:
    Feb 14, 2018
    Posts:
    9
    Thanks Stefan, I'll ping you next week regarding doing a remote session. I'm going to first try to see if I can debug this with my developer.
     
    Stefan-Laubenberger likes this.
  11. DesignVisionaries

    DesignVisionaries

    Joined:
    Jul 16, 2019
    Posts:
    1
    How do i get around the issue of
    Only MP3 with layer 3 specs is supported!

    Seems to only happen when i connect to the stream via android. but works fine on windows.

    I'm using broadwave which does provide an mp3 to connect to.
     
    Last edited: Sep 5, 2019
  12. Stefan-Laubenberger

    Stefan-Laubenberger

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

    The sample rate of your stream is below 32000 and the decoder declares it as an invalid stream:
    upload_2019-9-6_1-19-54.png
    https://en.wikipedia.org/wiki/MP3

    Radio uses a different implementation under Windows which is more tolerant towards "exotic" sample rates (and supports MPEG-2 and even MPEG-2.5).

    Please use a stream with a valid sample rate.


    Cheers
    Stefan
     
  13. HIroLionBld

    HIroLionBld

    Joined:
    Sep 20, 2019
    Posts:
    9
    Hi!

    I just bought the plugin, tried to run it, but when I use Play() function it gives me error "'Radio' is not supported on the current platform!"
    I don't know what I'm doing wrong?
    I checked the documentation but there is nothing about this.
    Please help!

    Thanks
     
  14. Stefan-Laubenberger

    Stefan-Laubenberger

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

    What's your current build target?
    WebGL and WSA are not supported.


    Cheers
    Stefan
     
  15. HIroLionBld

    HIroLionBld

    Joined:
    Sep 20, 2019
    Posts:
    9
    Really? I am building for WebGL, is there no way to use this? otherwise I will have to ask for a refund. :(
     
  16. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,980
    This is unfortunately the case; we tried to find a good solution but until now, we haven't found one that works good enough. :(
    If you really want to use it only for WebGL, then send your invoice via email and I will issue a refund.
     
  17. HIroLionBld

    HIroLionBld

    Joined:
    Sep 20, 2019
    Posts:
    9
    Okay, I forwarded payment mail from Unity to you.
    Why is it not possible for WebGL tho?
    It was unexpected. Thank you for the quick reply!
     
  18. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,980
    Mainly because WebGL has (currently) no threads and CORS makes it nearly impossible to stream any station besides your own.

    I will process your email in the next 48h.
     
  19. trurl22

    trurl22

    Joined:
    Mar 3, 2015
    Posts:
    2
    Hello, I tested your asset and love it, games and radio is a perfect marriage, however I fell at the first hurdle of trying to get permission from casters. YourClassical is an accomplished, but still pretty niche collection of 10 streams. I mentioned how the game would act as a streaming client and not store anything, how I'd be loyal to their stuff only, how well it tested, how their name would be shown, and click-through to their site and how it isn't much different to a new skin, except for all-new listeners. This is all they (parent company) had to say:
    "Minnesota Public Radio is not the copyright holder of the music broadcast and streamed by its Classical Music Service and cannot give permission for its use.
    You may want to check out licensing organizations such as ASCAP, BMI, or SEASAC"
    Should I reformulate my message more convincingly, or is this a dead end? I was really hopeful of their go-ahead.
     
  20. Stefan-Laubenberger

    Stefan-Laubenberger

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

    Our standpoint is that a public reachable radio station is just like a real, old school radio.
    We receive the "radio waves" they send out to everybody.

    Anyway, you could try to reformulate it in a sense that it's a benefit for them, since they're able to reach out to a lot more consumers for their ads. Online radio is a though business and they could profit.

    On the other hand, if they don't allow it, there isn't much you could do. The good thing is, there are thousands of stations waiting to provide content for your game.


    Cheers
    Stefan
     
    trurl22 likes this.
  21. Aske_S_K

    Aske_S_K

    Joined:
    Mar 9, 2014
    Posts:
    13
    Hi Stefan

    How do I set the URL of a RadioPlayer by script?
    I have looked into documentation, tutorial and API and can't figure it out.
    This is my class. I can add the component and it's there in the editor but when I try to alter the variable it gives a null reference error (see below).

    Code (CSharp):
    1. using Crosstales.Radio;
    2.  
    3. public class RadioFeature : PlayFile
    4. {
    5.     RadioPlayer theRadioPlayer; //TODO consider using SimplePlayer instead
    6.  
    7.     private void Awake()
    8.     {
    9.         LocalAudioSource = gameObject.AddComponent<AudioSource>();
    10.         theRadioPlayer = gameObject.AddComponent<RadioPlayer>();
    11.  
    12.         print("theradioPlayer go name: " + theRadioPlayer.gameObject.name);
    13.  
    14.         theRadioPlayer.Station.Url = "http://185.33.21.112:11010";
    15.         theRadioPlayer.Play();
    16.     }
    17. }

    //Log
    NullReferenceException: Object reference not set to an instance of an object
    RadioFeature.Awake () (at Assets/Scripts/Features/RadioFeature.cs:15)
     
  22. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,980
    Hi Aske

    The station is null per default, so you have to set it like this:
    Code (CSharp):
    1. using UnityEngine;
    2. using Crosstales.Radio;
    3. using Crosstales.Radio.Model;
    4. using Crosstales.Radio.Model.Enum;
    5.  
    6. public class RadioFeature : PlayFile
    7. {
    8.     RadioPlayer theRadioPlayer;
    9.  
    10.     private void Awake()
    11.     {
    12.         LocalAudioSource = gameObject.AddComponent<AudioSource>();
    13.         theRadioPlayer = gameObject.AddComponent<RadioPlayer>();
    14.  
    15.         print("theradioPlayer go name: " + theRadioPlayer.gameObject.name);
    16.  
    17.         RadioStation station = new RadioStation("1.FM - All Euro 80's Radio", "http://185.33.21.112:11010", AudioFormat.MP3);
    18.         theRadioPlayer.Station = station;
    19.         theRadioPlayer.Play();
    20.     }
    21. }
    I would suggest you use "Start" instead of "Awake", but it works anyway.

    I hope this helps you further, please let me know if it works for you.


    So long,
    Stefan
     
  23. Aske_S_K

    Aske_S_K

    Joined:
    Mar 9, 2014
    Posts:
    13
    Hi Stefan

    UPDATE: I can build to Android apk from my editor directly.

    Radio Pro works fine in the editor but I can't build for Android using Unity Cloud, which I could before I imported your asset.
    Firstly I imported the asset into a secondary empty project, then exported from there into my main project to see how many scripts was unnecessary for just playing a radio station.

    But after that failed I ended up deleting the folders and the importing the asset directly from asset store to my project and still get the following error. Do you have any idea of whats wrong?

    "
    [Unity] DisplayProgressbar: Unity license
    2: [Unity] Initialize engine version: 2019.2.5f1 (9dace1eed4cc)
    3: [Unity] -----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Assembly-CSharp-firstpass.dll
    4: [Unity] Assets/Plugins/crosstales/Radio/Scripts/RadioPlayer.cs(55,19): error CS0246: The type or namespace name 'NVorbis' could not be found (are you missing a using directive or an assembly reference?)
    5: [Unity] Assets/Plugins/crosstales/Radio/Scripts/RadioPlayer.cs(56,19): error CS0246: The type or namespace name 'NLayer' could not be found (are you missing a using directive or an assembly reference?)
    6: [Unity] Assets/Plugins/crosstales/Radio/Scripts/RadioPlayer.cs(55,19): error CS0246: The type or namespace name 'NVorbis' could not be found (are you missing a using directive or an assembly reference?)
    7: [Unity] Assets/Plugins/crosstales/Radio/Scripts/RadioPlayer.cs(56,19): error CS0246: The type or namespace name 'NLayer' could not be found (are you missing a using directive or an assembly reference?)
    8: [Unity] -----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Assembly-CSharp-firstpass.dll
    9: [Unity] Assets/Plugins/crosstales/Radio/Scripts/RadioPlayer.cs(55,19): error CS0246: The type or namespace name 'NVorbis' could not be found (are you missing a using directive or an assembly reference?)
    10: [Unity] Assets/Plugins/crosstales/Radio/Scripts/RadioPlayer.cs(56,19): error CS0246: The type or namespace name 'NLayer' could not be found (are you missing a using directive or an assembly reference?)
    11: [Unity] Assets/Plugins/crosstales/Radio/Scripts/RadioPlayer.cs(55,19): error CS0246: The type or namespace name 'NVorbis' could not be found (are you missing a using directive or an assembly reference?)
    12: [Unity] Assets/Plugins/crosstales/Radio/Scripts/RadioPlayer.cs(56,19): error CS0246: The type or namespace name 'NLayer' could not be found (are you missing a using directive or an assembly reference?)
    13: Fatal Error! It looks like another Unity instance is running with this project open.
    14: [Unity] DisplayProgressbar: Unity license
    15: [Unity] Fatal Error! It looks like another Unity instance is running with this project open.
    16: publishing finished successfully.
    17: error: attach failed: Error 1
    18: Finished: FAILURE
    "
     
  24. Aske_S_K

    Aske_S_K

    Joined:
    Mar 9, 2014
    Posts:
    13
    Thank you for that, once I get the Android build to work I'll long into it. I missed your answer, sorry.
     
  25. Stefan-Laubenberger

    Stefan-Laubenberger

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

    I'm a bit confused - are you able to build the apk or not?

    However, it looks like not all necessary dlls are imported; did you exclude anything from the "Common" folder?
    The dlls "CTNLayer.dll" and "CTNVorbis.dll" have to be inside the project; is that the case?


    Cheers
    Stefan
     
  26. Aske_S_K

    Aske_S_K

    Joined:
    Mar 9, 2014
    Posts:
    13
    Sorry about the confusion. Yes I can build, but only from editor, not from Unity Cloud.
    And the files are there.
    Any idea about why it won't work with the cloud? Have you tried it with Unity cloud?
     
  27. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,980
    We don't use "Unity Cloud"-builds since we want to be in control what's happening.

    Anyway, I see there are other errors like "Fatal Error! It looks like another Unity instance is running with this project open."; could that impact the build?
    Please also make sure the two dlls have all platforms selected (except WebGL and WSA).

    I'm currently on holiday, so I can't test it with "Unity Cloud", but I will do it after my return next week.
     
  28. Aske_S_K

    Aske_S_K

    Joined:
    Mar 9, 2014
    Posts:
    13
    That error shouldn't be relevant (see: reff).
    I appreciate that you'll have a look at it when you get back. I enjoy the cloud build service.
    Enjoy your holiday :)
     
    Stefan-Laubenberger likes this.
  29. dramdan1st

    dramdan1st

    Joined:
    Apr 10, 2017
    Posts:
    2
    Only MP3 with layer 3 specs is supported! what i do sorry??
     

    Attached Files:

  30. Stefan-Laubenberger

    Stefan-Laubenberger

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

    What is your Editor or build platform?
    If it's not Windows, this station won't work since it has not a valid MP3-sample rate:
    upload_2019-12-31_10-32-11.png


    Here are the specs from Wikipedia:
    upload_2019-12-31_10-35-8.png

    You can ask the station to provide a higher sample rate or use another one.


    Cheers
    Stefan
     
  31. robbus1st

    robbus1st

    Joined:
    Jul 23, 2013
    Posts:
    13
    im uaing unity3d for build Android and iOS platform. I have to configure stream but still not working how i should configure bitrate chunk size and buffer size too in RadioPlayer??
     

    Attached Files:

  32. Stefan-Laubenberger

    Stefan-Laubenberger

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

    The problem are the IceCast settings.
    Since you selected a very low bit rate and left the "Sample Rate" to auto, it selects "22050 Hz" as best setting for the sample rate.

    For the sake of the quality of your stream, I would strongly suggest to change the "Sample Rate" to 44100 Hz and the "Bit Rate" to at least 96 - even better is 128 or more. To save some bandwidth, you could change the "Bit Rate Mode" to VBR.
    Here are the relevant settings to change:
    IceCast-settings.png

    Please let me know if it works.


    Cheers
    Stefan
     
  33. SuperDanOsbourne

    SuperDanOsbourne

    Joined:
    Oct 3, 2017
    Posts:
    46

    Hi, I came across your asset because I was also interested getting streams in WebGL. could you give me any details on setting up my own streaming station to use? I'm pretty sure I still want to grab your asset for use on other platforms as I'm getting into IOS and Android but anything I could achieve with WebGL would be great. Thanks :)
     
  34. Stefan-Laubenberger

    Stefan-Laubenberger

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

    Unfortunately, WebGL still has no threads and Radio can't therefore work on this platform.
    The same is true for UWP (WSA), but it will work on the other platforms you mentioned.


    Cheers
    Stefan
     
  35. Aske_S_K

    Aske_S_K

    Joined:
    Mar 9, 2014
    Posts:
    13
    Does this mean it can build with Unity Cloud now, have had a chance to look at it?
     
  36. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,980
    I just tested building for Android with Unity 2019.2.11 and "Cloud Build":
    upload_2020-1-10_14-7-57.png

    upload_2020-1-10_14-11-0.png
    It works on my side. Can you please try it?
     
  37. Aske_S_K

    Aske_S_K

    Joined:
    Mar 9, 2014
    Posts:
    13
    Alright, thank you for testing it. However, it still doesn't work for me :/

    I have tried with the newest release and it doesn't work. Still the same error. I'm using Unity 2019.2.5.f1 and I've set .NET to 4.x (also tried before changing .NET from standard 2.0).
    I have tried deleting the entire plugin including commons and re-importing.
    I've tried setting the .dll's to specifically target iOS and Android instead of "Any Platform". (CTNLayer, CTNVorbis and also CTNAudio just to make sure).
    (See screenshot).

    When I initially imported the asset, I did it by exporting from another project and in to this. Then later I have imported to this project directly from Asset Store. Can something have gone wrong through that process, how do I reset then? Since I have tried deleting the entire plugin and then importing directly afterwards.

    Any other ideas to why it doesn't work?
     
  38. Aske_S_K

    Aske_S_K

    Joined:
    Mar 9, 2014
    Posts:
    13
    Forgot screenshots...
     

    Attached Files:

  39. Stefan-Laubenberger

    Stefan-Laubenberger

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

    Unfortunately, I've got no idea why this is happening :(

    Can you please try "Cloud build" for Android with a new, empty project and only our asset in it?

    Thank you!


    Cheers
    Stefan
     
  40. Aske_S_K

    Aske_S_K

    Joined:
    Mar 9, 2014
    Posts:
    13
    Alright. I will, but can't do it right now. Other things has come up, so for now I'll just build without radio feature or offline.

    Thank you for your help. It must be something on my end then.
     
  41. Aske_S_K

    Aske_S_K

    Joined:
    Mar 9, 2014
    Posts:
    13
    Hi again Stefan

    I've noticed that my build size of the app increased a lot after importing the radio asset. I only use the asset to stream radio with. Everything about how the user loads a station, equalizers, graphics and such is not needed. And I have had a hard time excluding what I don't need. Maybe it's me who hasn't understood it properly. But if I only want the very basic functionality of streaming radio and avoid making the app build size too big, how can I achieve this with your asset?
     
  42. robbus1st

    robbus1st

    Joined:
    Jul 23, 2013
    Posts:
    13
    Now its work. big thanks for quick response.

    But when screen off to lock the music has stop. Do you know how radio run in background anytime ?? Thank you.
     
  43. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,980
    You can safely delete the following folders:
    • Assets\Plugins\crosstales\Common\UI
    • Assets\Plugins\crosstales\Radio\3rd party
    • Assets\Plugins\crosstales\Radio\Demo
    • Assets\Plugins\crosstales\Radio\Documentation
    I hope this helps you further.
     
  44. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,980
    Great to hear it's working!

    There is a manual under "Documentation" called "Running Radio in the Background.pdf" which should explain all the steps to keep the asset playing in background.
     
  45. robbus1st

    robbus1st

    Joined:
    Jul 23, 2013
    Posts:
    13
    thanks for response,
    it's working for iOS phone but not working on my Android phone.
     
  46. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi Crosstales team,

    Did Radio Pro supports running in the background to listening radio/music? Thx!
     
  47. robbus1st

    robbus1st

    Joined:
    Jul 23, 2013
    Posts:
    13
    Hi you can read manual documentation “Running Radio in the background”. I try to ios phone its working, but not for android device. I dont known i forget.
     
  48. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi, I don't find any info about "Running Radio in the background" in documentation :(.
     
  49. Stefan-Laubenberger

    Stefan-Laubenberger

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

    This is a separate document inside the asset, it's located under "Documentation".


    Cheers
    Stefan
     
  50. robbus1st

    robbus1st

    Joined:
    Jul 23, 2013
    Posts:
    13
    hi I am trying to develop according to the document settings. but still not work on android device

    have any idea?
     

    Attached Files: