Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

How to play sound from URL adress by code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to play sound from URL adress by code

    Hello Ninjas

    I would like to provide my customers a special alerts sounds.
    O need to play sounds from a specific URL adress, for example, now I use this code:
    PlaySound(NinjaTrader.Core.Globals.InstallDir + @"sounds\Alert4.wav");
    I need to play like this:
    PlaySound("http://ninjaconnectbrasil.com/wp-content/uploads/2022/07/Activated-shutdown-system-after-closing-position.wav");

    This simple way is not working, and dont show any message, do you have some code idea to help me??

    Thanks

    #2
    Hello MarceloF,

    Thanks for your post.

    A URL address cannot be passed into the PlaySound() method. The PlaySound() method requires a local file to be used.

    You would need to download the sound file and then use the local path of that file when calling the PlaySound() method.

    Note that the underlying framework used to play the sound requires the audio file to be in PCM .wav format.

    See this help guide page for more information and sample code: https://ninjatrader.com/support/help.../playsound.htm

    Let me know if I may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by f.saeidi, Today, 12:14 PM
    7 responses
    16 views
    0 likes
    Last Post f.saeidi  
    Started by Russ Moreland, Today, 12:54 PM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by philmg, Today, 12:55 PM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Started by TradeForge, 04-19-2024, 02:09 AM
    2 responses
    32 views
    0 likes
    Last Post TradeForge  
    Started by aprilfool, 12-03-2022, 03:01 PM
    3 responses
    329 views
    0 likes
    Last Post NinjaTrader_Adrian  
    Working...
    X