WP8 toast notification with custom sound - windows-phone-8

I'm currenly writing an app where I need to use custom sound for toast notifications (which is sent from cloud). MSDN states that the audio clip must be stored in the app's installation directory or local storage folder. So how is this done?
I tried the CopyToIsolatedStorage() code sample from How to play background audio for Windows Phone. It fetches the audio clip correctly but when the toast should be shown the device won't play any audio or even show the toast which indicates that it can't find the audio clip correctly. In the app, I have a method which shows contents of the push notification when the app is in foreground. From there I can see that the toast notification is sent and received correctly with toast.mp3 sound tag. So the problem must be in the app but I can't figure out what I did wrong.
Tl;dr version:
I want to change toast notification sound, my device is running WP8 with Update 3 and I have a 5 sec long mp3. I can't figure out how and where I should put the audio clip.

I dont think you need to copy the sound to isolated storage, just put it in your main project and set it as content. Then in your Push just reference it.
<wp:Sound>toast.mp3</wp:Sound>
Or if it is in the Assets folder in your project do
<wp:Sound>Assets/toast.mp3</wp:Sound>
Note: This only works for Windows Phone 8 Update 3 and later, works fine for all Windows Phone 8.1.

So the problem was that I blindly assumed one can reference to the audio clip with just <wp:Sound>toast.mp3</wp:Sound> or new Uri("toast.mp3", UriKind.RelativeOrAbsolute), as in the MSDN tutorial, when the file is copied to the root of the isolated storage but this isn't the case. You'll have to include the directory where the clip is in your project to the path, in my case Audio\. Thaks goes to WiredPrairie for pointing this out.
So to wrap things up:
Copy the audio clip which you want to use to the isolated storage with CopyToIsolatedStorage() from How to play background audio for Windows Phone and follow the instructions in Using custom sounds in toasts on Windows Phone 8 Update 3 . And remember to include the directory structure to the path of the clip or put the clip in the root of your project.

Related

Adobe Animate cc 2017 - HTML5 freezes when I publish/test project with audio

Adobe Animate cc 2017 - HTML5 freezes when I publish/test project with audio
I'm working on a small game, using Animate 2017 and exporting it to HTML5. I'm using createjs.Sound to add the sound fx I've added to the library. When I publish or "test" the project, it freezes the loading bar. On OSx it stays at 0%, on windows it goes up to 70% but freezes anyway. The only option being to force quit the app. I'm following a tutorial from Pluralsight, and I've tested the tutor's project and I get a slightly different issue, the project gets published, the browser starts everything automatically but nothing happens afterwards, instead of the game starting, it just stays a black canvas (no errors in the console).
A few more data to help troubleshoot, the tutor's project is using .mp3 files and I'm using .wav audio. I've been trying to look through the OSX auto generated error report, but I can't make heads or tails of what it says.
Animate mac/windows version - 2017.0.1 Release (16.0.1.119)
Turns out it was a corrupted symbol or something that was causing the program to crash. Converting the project to ActionScript 3 and then back to HTML5 solved the issue.
https://forums.adobe.com/thread/2425008
If anyone experience a AnimateCC crash issue in Mac, It might be an issue with long audio file name. I found that if the audio file name is greater than 29 characters, AnimateCC crashes when publishing. Here is a sample test file.
https://drive.google.com/file/d/1dEBdM4laszCXFa3Bz4tS3yHh-8PbLaGo/view?usp=sharing
As you can see, the file crashes when you try to export. It has only one sound file in the library. When you remove one character in the file name, it gets published successfully. I tested this in AnimateCC version 18.0.2 (Build 126).

WP8 MPNS custom sound file not played completely

I have implemented custom sound for push notifications in wp8. Everything works fine , but the custom sound file is not played completely (when app is in background). the sound file is 8 seconds and meets requirements. can someone let me know why the sound file is not played completely ?

How do I play custom audio for Toast notifications?

I can receive Toast notifications on my phone, but I can't seem to specify the audio it should play.
I've modified the toast XML to include a sound, e.g.
<?xml version="1.0" encoding="utf-8"?>
<wp:Notification xmlns:wp="WPNotification">
<wp:Toast>
<wp:Text1>TOAST TEXT</wp:Text1>
<wp:Text2>This is a toast</wp:Text2>
</wp:Toast>
<wp:Sound>myfile.mp3</wp:Sound>
</wp:Notification>
But this doesn't work.
What do I need to do to make it work?
Toast with sound works only on Windows Phone 8 Update 3 and later versions. Make sure the file you specified in your XML is stored in the proper location. Also make sure the sound file is less than 10 seconds long.
Windows Phone 8 Update 3 (OS version number 8.0.10492) introduces the
ability to provide a custom sound for toast notifications. Sound files
can be in WAV, WMA, or MP3 format, must be less than 10 seconds long,
and must be stored in the app’s installation directory or local
storage folder.
To use a custom sound for a toast that is launched via a cloud
service, all you need to do is include a Sound element in the XML
payload. To launch a silent toast, you can use the Silent attribute,
set to “true”.
See code samples here.

Launch music from sd card in wp8

I am working a wp8 app which can read some different types file.Then launch them in a simply way.Like we can launch mp3 using MediaPlayerLauncher .But I failed.Any help will be kind to me.Thanks
I assume that you managed to use ExternalStorage. Firt of all you are not able to see this (mp3) files because they are reserved. What you can do is to change extensions to them and copy to InternalStorage. As you have done that you can play them well with MediaElement or BackGroundAudio.
Also it's not possible (for now) to play directly from ExternalStorage (SD card).

Database content not retrieved in the exported SWF and published HTML

I have this problem that when i am running my project in Flash cs6 using ctrl+enter, the project is ok, the flash player is retrieving the files from mysql database. but when i run the independent swf file outside, there is no retrieval happening. the text box that suppose to be showing the retrieved data is empty. how can i fix this?
Make sure you are running the published html from an actual page in the browser and not from the local file system.
Just make sure that the URL doesn't start with file:///
You must be having a security sandbox error, but you probably don't have the Debugger version of the Flash Player, so it's not telling you anything.
Just go to http://www.adobe.com/support/flashplayer/downloads.html and choose the proper one for your operating system and browser.
If you STILL want to run the files from your local file system, you can have a look at Flash Player's Global Configuration, to give access to the files/directories you want. Just right click on your swf file in the browser, and when the Menu opens, select Global Configuration.
The reason it is working when running inside Flash CS6 is that the player has less security restrictions in there.
Let me know if you were able to solve your problem.