BackgroundMediaPlayer share data with Foreground in Windows Phone - windows-phone-8.1

I need to share an audio file which is opened (read-only) from foreground task (UI), and is being played by the BackgroundMediaPlayer task in Windows Phone 8.1.
While it is being played in the background, I also need to access the same file from the foreground UI, again as read-only to retrieve its byte content.
What is the best way to achieve it?
Is storing it to IsolatedStorage an option?

Related

OneDrive not available in FilePicker

I am playing alittle with windows phone 8.1 app creating. Using C# and phone emulator in VS2013. I have read on microsoft's page that i should be able to see OneDrive in standard file picker (msdn.microsoft.com/en-US/en-en/library/windows/apps/dn263258.aspx):
Use the built-in Windows features.
Whenever possible, use the Windows features and UI to host or interact
with OneDrive. For instance, use the file picker provided by the
Windows.Storage.Pickers namespace for opening and saving files. As
another example, have your app use the Windows application data APIs
to save smaller pieces of data across a user's devices.
I am using standard code from tutorial like:
openPicker.FileTypeFilter.Add("*");
StorageFile file = await openPicker.PickSingleFileAsync();
and it works but there is no OneDrive to choose. I have internet connection on emulated device and i am logged in to OneDrive.
Have you integrated your file picker with the OneDrive contract?: http://msdn.microsoft.com/en-us/library/windows/apps/hh465192.aspx
You can also use the Live SDK single sign-on feature for Windows Phone here: http://msdn.microsoft.com/en-us/library/dn631823.aspx This way, your app should work for your testing purposes because you are already signed in.
I hope this helps!

File upload control in windows phone

How top upload a file in wp8.I could not find upload control.Is it possible to upload a document and can it open hard disk memory(where document resides)
Thanks in advance
In windows phone 8, There is no control like FileUpload instead of that you need to use Background Agent to upload files. here are two Good Samples you can go through How to Upload a File from a Windows Phone App and Auto-upload Sample

how to download audio file from from uri and save in local folder in windows phone 8?

I've got various types of ringtone in my server. I need to know how to read those audio files and save into my Windows Phone 8 directory.
How large are the files? The BackgroundTransferRequest API is one way you could download files. It is especially useful for larger files. Since this class downloads in the background it is nice in that you can navigate around your app and even leave it without having to cancel your download.
It also has some built-in functionality that will help limit downloads when you are on wireless vs wifi so your app won't accidentally eat up your user's data plan.
Here's some info on Background file transfers:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202955%28v=vs.105%29.aspx
http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202959%28v=vs.105%29.aspx
An alternative is using an Http request using either the HttpWebRequest or WebClient classes. These options are good when you have smaller files and when you know you have a stable network connection. They will also work with larger files but they don't have the extra features that BackgroundTransfer API has for longer running downloads.
http://developer.nokia.com/community/wiki/Making_a_HTTP_request_and_listening_its_completion_in_Windows_Phone

BackgroundAudioAgent with a dynamic playlist

I am developing an app that has the capability of playing audio tracks streamed from a server. This app needs to be able to playback the audio even when the screen is locked or if the app is put in background.
=====
For background audio playback in windows phone, the Background Audio Agent is required.
The sample provided by Microsoft shows the basics: http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202978(v=vs.105).aspx
In the sample, the background audio agent has a list of static tracks and when the user taps the skip/prev in the main project, it simply forwards it to the singleton BackgroundAudioPlayer object which in turn uses the event handler in BackgroundAudioAgent project to load the next/prev song.
BUT, what I would think a common usecase is that the main project will have the details of the play list (like a list retrieved from server) and we just need the backgroundaudio agent to forward that request to the main project.
My question is
Is there ANY way to forward the user action from audio agent to the main project so the main project can determine which track to play?
P.S: I cannot use MediaElement (which seemed to work fine in Window Store App and provides background support) because in Windows Phone SDK it has no background support.
EDIT: When the screen is locked, The application itself can be terminated even if the background agent is running, so I guess there no mechanism to forward the request to the app. This would mean, The background agent has to be self sufficient... Which would be a poor design to have to jump through hoops for a seemingly common behavior (Playing audio stored in remote server that requires authentication) .
At this point, I am considering writing all URL specific information to a file and have the background audio agent read that saved file and authenticate with server and create audio tracks. But the handshake to show the current audio information when the application resumes will be complex to say the least.
I hope I am wrong with this and there is actually a easier way than this. Would love to see how others have handled this.

Getting captured video from Windows Phone 8

While Microsoft appears to have a robust video capture API for Windows Phone 8, it appears that any videos captured must be stored in the application's local storage, which is not accessible from the File Explorer when the WinPhone 8 device is connected to a Windows 8 PC.
Also, the app cannot store the videos anywhere the user could easily copy them from the phone. It is limited to its own isolated file system. This stackOverflow posting explains how the Win8 phone is locked down:
Windows Phone 8: Media file access
So, I can capture and store a video, but how do I get it off the phone to somewhere a user can manipulate it?
If you want those captured video off your phone then you can email/share it using ShareMediaTask & then can get that video out off the phone.
May be its not worth your requirement but if the purpose is to get it out off phone then it will help.