Play Audio from Task

0
0

I have a timer that starts an Task which get some information from an Database.

Based on this information i update the UI with Application.Update.

That all works great.

From time to time (depending on the the data i get) i have to play a sound file.

I try this with:

audioHelp.SourceURL = url;
Application.RunInContext(this, () =>
{
audioHelp.Play();
});

audiohelp is Wisej.Audio

When i bind this function to an button.Click event all is working fine.

But when i try to do so in the “Background”-Task there is no sound playing.

Can please someone give me an hint where to find my error ?

Many thanks

  • You must to post comments
0
0

Got it.

Perhabs someone is stumbling over the same problem.

The Solution was in the settings of the Chrome Browser.

WebsiteSettings: Unsecure Content : Unblock

After changing that the Backgroundtask plays Audio as intended.

  • You must to post comments
0
0

Hi Tom,

Test this (sample) :
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);

Application.StartTask(() =>
{

//test URL :-P
audio1.SourceURL = "https://il.ilill.li/force/FZAX5pZ80S/";
audio1.Play();
});
}

For more information with multi-threading, you can go there: https://wisej.com/docs/2.2/html/BackgroundTasks.htm

Best,

Kevin(ITG)

 

  • Tom Oeben
    Hi Kevin, thats the same way my function works……….. Again. The problem is not the Task. If i bind the function (Multi-threading) to an button click event all is working fine. But i when i call it from the task that gets the data from the database it`s not working. I also change some colors on the UI in that task and do an Application.Update. Thats is working fine. Playing the sound file does not……
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.