I have an mp3 file included in the Resources folder of my Windows Phone 8 project. The file plays in normal scenarios.
However, in case the file is played and stopped many times, it starts giving the following exception when I call MediaPlayer.Play(song):
Song playback failed. Please verify that the song is not DRM protected. DRM protected songs are not supported for creator games.
If I try to access MediaPlayer.State in such a scenario, it gives me the following error:
Value does not fall within the expected range.
Any attempt to play the file after this fails and gives the above error. The file is able to play only after terminating and relaunching the app.
I have also checked the properties of the file and it's protection is Off.
Kindly help me in case any of you have come across the same issue and have a solution for the same.
Thank you
Can you try to create MediaPlayer element dynamically?
MediaElement ME = new MediaElement();
ME.Source = new Uri("source of file");
ME.Play();
Related
this is my first question here. I apologize in advance if I make some mistakes.
I'm writing a software that call a customer number (audio/voiced) when a button is pressed with as little delay as possible. It's for Windows, using C++ on MS Visual Studio 2017. The requirement are as follows:
Load all the mp3 files onto memory
Whenever signal is received/button is pressed, construct a playlist containing only relevant mp3 files to the customer number being called
Play the playlist on certain designated audio output device (there are multiple soundcards installed)
Destroy the playlist after the session ended
I have tried the Playlist sample from Microsoft Media Foundation sample and it worked. Unfortunately the sample does not preload all mp3 files onto the memory so there are couple hundred ms delay each time the playlist is played.
I also have tried using bytestream (IMFByteStream). I load all the mp3 files onto vector of IMFByteStream pointers, then everytime signal received/button pressed, I construct the media source (IMFMediaSource). Unfortunately it only ran once. After the media source is shutdown after the session ended, the bytestream became unusable (error "the provided bytestream expected to be seekable" or MF_E_BYTESTREAM_NOT_SEEKABLE when trying to create media source using CreateObjectFromByteStream).
hr = pSourceResolver->CreateObjectFromByteStream(m_pMediaStreams[media_source_index].pStream, NULL, MF_RESOLUTION_MEDIASOURCE, NULL, &ObjectType, &pSource);
Clearly I did something wrong. Any hints and pointers are greatly appreciated. If some portions of the code are needed then I will post it here. The code is big and I don't know which parts are relevant.
Many thanks
So it looks like Windows 10 Ransomware has broken my app (StationRipper). It's a C++/MFC app, but it looks like it would break any app that is doing what StationRipper is doing.
My high-level question:
My app needs to write files (e.g., mp3's) as it records them. Is there actually a sensible place do this to (like, say, the Music folder) if Ransomware protection is on, or am I stuck just creating an arbitrary folder someplace? My app is doing the recording behind the scenes, so the user can't choose the dir for each file.
Details:
My app records music files. A very long time ago (like, in 2002) it wrote it to the users "Music" directory. That worked fine, but now I'm seeing a problem - I'm getting the error code for "The system cannot find the file specified." on CreatedDirectory for my app (which was really fun to track down, as that error code isn't listed as an error that CreateDirectory to return), and when I try to write any file to that directory if I manually create it via file explorer.
I finally tried running mkdir, and to create a file in that dir, outside of my app... the same thing happens.
I turned off Ransomware protection in Windows Defender... and it now works from my app.
It looks like I have to use something like the file picker to save to that dir? Which, as I said, won't work as the user isn't involved after they start recording.
I can't just tell my users to turn Ransomware protection off to use my app, but I would prefer to put the music files in their Music folder...
Any suggestions?
Additional info requested in comments:
TCHAR szDocPath[MAX_PATH];
szDocPath[0] = 0;
if (::SHGetSpecialFolderPath(NULL, szDocPath, CSIDL_PERSONAL, FALSE))
{
_tcscat(szDocPath, "\\StationRipper");
DWORD m_dwLastError = ::GetLastError();
BOOL bResult = CreateDirectory(szDocPath, NULL);
m_dwLastError = ::GetLastError();
}
Running the above with Ransomware protection on results in a zero. With it off returns a 1 (and the directory is created).
(note: SHGetSpecialFolderPath is not supported, but its modern equivalent, SHGetKnownFolderPath has the same issue)
Rather than asking users to disable Ransomware Protection entirely, you can ask them to whitelist your application. See the Whitelist apps with Controlled folder access section of this article (the official documentation is somewhat lacking).
I have a question, after I have whole built the AOSP source code, it generates couple image files, such as ramdisk.img, recovery.img, system.img, res-package.img,etc .
Right now, I am considering partial flashing my Android Box without formatting all of the system, for keeping some previous data remains.
Therefore, I just tried to use the command “adb sideload filename.img”, which filename might be ramdisk,recovery, etc.
Then, after I did so, the android system shows the message :
“footer is wrong”
“signature verification failed”
“Installation aborted”
There, what should I correct my command, to make the process correct?
as the figure shows enter image description here
And, my methods to do so is trying to refresh a new system feature, but keep the previous data, such as APPs, or user data, remain, does anybody have other good suggestions? Thank you in advance.
it depends on the flash type and file-system you are using, and it is not possible to partially flash in the partition, but you can update the partition.
I'm using cocoss2d with c++ on windows 10 and I'm trying to play background music. It works the first time I debug the game but on the second time I hit run it throws these exceptions
Exception thrown at 0x765F3E28 (KernelBase.dll) in MiniGolf.exe: 0x000006BA: The RPC server is unavailable.
Exception thrown at 0x765F3E28 (KernelBase.dll) in MiniGolf.exe: 0x0000000E: Not enough storage is available to complete this operation.
Assert failed: getFileSize should be override by platform FileUtils
Assertion failed!
I simply use this line to start the music.
CocosDenshion::SimpleAudioEngine::getInstance()->playBackgroundMusic("level_music1.wav",true);
I'm not sure what's going on can anyone share a light with me ?
cocos2d-x 3.9
CCWinRTUtils.cpp
line 336 added
if (ret[0] == '/') {
ret = ret.substr(1, ret.length() - 1);
}
Got it! It's not that good fix, but still.
File: CCWinRTUtils.cpp
Method: createMappedCacheFile
I have commented if/else construction and call FileUtils::getInstance()->removeFile(prevFile) all the time.
Now it works fine on both Windows10 and Windows Phone 8.1.
As I understand now the caching works only for current session. The previous solution (caching by hashtag) was for caching sounds loaded from the Internet and not needed for local files.
I get following message when I try to add "Periodic Task" to "ScheduledActionService" in Windows Phone 8 Application.
"The drive cannot locate a specific area or track on the disk."
I am really not sure if this is related to Visual Studio 2012 that I am using or related to Periodic Tasks on Windows Phone 8.
The same piece of code works fine in Windows Phone 7.
I found the solution here: http://social.msdn.microsoft.com/forums/en-us/wpdevelop/thread/a973955e-0981-4be8-8ac0-8dfcb9dc2917/
You need to manually update your WPAppManifest.xml file and configure the background task there.
Appears to be normal behavior, not related to emulator or debugging.
There is a excellent explanation as to what is required by microsoft for background task in the msdn tutorial videos.
It references your problem at around 24:30 with editing the WPAppManifest.xml file.
He explains step by step what needs to be done and why.
http://channel9.msdn.com/Series/Windows-Phone-8-Development-for-Absolute-Beginners/Part-34-Creating-a-Background-Agent-for-Scheduled-Tasks
Also I got a null reference exception after fixing the WPAppManifest.xml when called from the the main project, turns out the main project also has to reference the scheduler project (even if not using anything in it).
You have to add the ScheduledTaskAgent as a Reference to the main project.
I found this in the WPDT Notes
Runtime exception occurs when an application attempts to use a launcher/chooser in Microsoft.Phone.Tasks to call an application that is not present in the Emulator home screen. The following error string is displayed, “The drive cannot locate a specific area or track on the disk.” Workaround: Do not use the launcher/chooser or catch this exception.
http://download.microsoft.com/download/d/9/2/d926fb38-bb43-4d87-ae5a-1a3391279fac/releasenotes.htm.
(PS If you can't view the link Google "Windows Phone Developer Tools CTP Release Notes")