I'm going to write a function to play a mp3 file from an URL on Windows Mobile 6.0 without downloading all the stream to mobile. I read some documentation and faced some problem that.
Using NAudio.dll
: The dll is not compatible for Windows Mobile
Using DirectShowLib.dll : have not found way to get from audio stream.
Is it true that we can't get an audio Url Stream in Windows Mobile 6.0? Is there any way or any dll else to help me?
Which windows mobile? 6.5 or 7?
7 uses Silverlight so it should be really easy to do smooth streaming (never tried it).
6+ I'm not so sure, maybe use a WCF filestream to get the stream?
I find out Bass library work well on my specific issue - play mp3 audio from url on windows mobile 6.
Add bass_cp.dll to your solution. And make sure to copy the bass.dll to your execute directory.
And what you need to do is very simple:
int stream = Bass.BASS_StreamCreateURL(strUrl, 0, 0, null, IntPtr.Zero);
Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);
Bass.BASS_ChannelPlay(stream, false);
Of course after you register for the dll. Then add this code line at first:
BassNet.Registration(string email, activated key);
Related
I am new to Windows Phone developing and I am trying to copy a file from PC to Windows Phone Documents folder. I read and tried what is written in this article Copy files with WPD to Windows Phone C#. The original article is https://dzone.com/articles/creating-apis-for-mobile-iot-apps. Unfortunately I got an error of ArgumentException in the line:
targetStream.Write(buffer, bytesRead, pcbWritten);
I think it's related to the parameter ParentObjectID, when I call the method:
device.TransferContentToDevice(#"H:\temp\QuestPhone\Pesquisas.db",#"G:\Documents");
I tried to replace "G:\Documents" by "Windows Phone:\Documents", and "Phone:\Documents" and "Windows Phone:\Phone\Documents" but without success.
So, how can I specify the "logical drive" where my Windows Phone device is connected to?
After some time I got a solution. The correct ParentObjectID is #"o1". "o1" is the ID of documents folder on the device.
I am trying to play an audio stream from stream server in my windows phone app. I read on Microsoft Documentation that I have to reference an Audio Stream Agent.
I have these projects in my solution :
I've tried to reference a new project as Audio Streaming Agent in my Windows Phone 8.1 application
but I keeping receiving the error :
I read that I have to change the target framework, but there is no option for target framework in the AudioStreamAgent1 properties.
Also, Can I do this using an application that is not the Silverlight kind? Is there a way to do without using the Silverlight one?
The problem is that the AudioSteamAgent is targeted at WP Silverlight, and your actual app is WP8.1 (WinRT).
To create background audio in WP8.1, you will want to use the Background Media Player.
You can find a great guide for how to get started here.
But basically (without all the boilerplate code to wire everything up), it comes down to telling the BMP what to play (code is from the link above):
BackgroundMediaPlayer.Current.SetUriSource(new Uri("ms-appx:///Assets/Media/Ring02.wma"));
BackgroundMediaPlayer.Current.Play();
And telling the OS player controls what to show, and what to do when the user interacts with them:
systemmediatransportcontrol = SystemMediaTransportControls.GetForCurrentView();
systemmediatransportcontrol.ButtonPressed += systemmediatransportcontrol_ButtonPressed;
systemmediatransportcontrol.PropertyChanged += systemmediatransportcontrol_PropertyChanged;
systemmediatransportcontrol.IsEnabled = true;
systemmediatransportcontrol.IsPauseEnabled = true;
systemmediatransportcontrol.IsPlayEnabled = true;
systemmediatransportcontrol.IsNextEnabled = true;
systemmediatransportcontrol.IsPreviousEnabled = true;
This is all assuming that you want the user to be able to leave the app and have media continue to play. If you just want to stream audio/video while the user is in the app you can use the MediaElement control.
When I try to play a sound with a media element on my local machine I can't hear any sound. But I can hear sound in the simulator(same thing almost right?) and on my surface when I test it on there. It Doesn't work on all my pages too not just one on the local machine only too.
load event goes off in simulator but not in local machine. Also stream isn't null.
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/Sound/" +selectedCharacterSets[currentCharacterSet].character[currentCharacter].romaji + ".mp3", UriKind.Absolute));
var stream = await file.OpenAsync(FileAccessMode.Read);
mdeSound.SetSource(stream, file.ContentType);
Media failed event going off. Error: MF_MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED : HRESULT 0x8000FFFF. Does anyone know how to fix this and why its only on local machine?
EDIT: converted mp3 to wma... still doesn't load. converted it to wmv now it plays on local machine... why? I'm still confused. Opening the mp3 in the music app throws an error too, windows media player plays it fine.
There is an issue with the file you are trying to play. This could be because of DRM or because of bitrates being too high, etc. Windows 8 Pro can play more codecs than Windows 8 RT, but you said it worked on your Surface which is interesting. Try using Audacity or another program to save it as a lower bitrate MP3 or even a basic .WAV file.
It's also interesting that you couldn't play it as WMA but you could as WMV. WMV is video while WMA is audio. You may have a corrupt media stack on your machine.
P.S. The simulator essentially uses Remote Desktop, so there is a difference in how the audio gets played.
am developing an application which can fetch files from internet.. how do i download and save a "docx" or "wav" file from internet within the application and use it later with other application likes office or windows media player.
You can download files in the background (ie. they will continue even when your application is not running).
Having said that, you should research the types of files you need to support. For example, you can play an audio file (if the format is supported) or add it to Music hub but you cannot open a file in Office. Very few filetypes can be integrated with, so do some research before you start writing your app otherwise you might be disappointed.
place an image control in your page. here im1 is controls name.
it is working for me
string imgurl="http://.........";(path)
Uri addrs=new Uri(imgurl,UriKind.Absolute);
BitmapImage bitmap = new BitmapImage(addrs);
im1.Source = bitmap;
i have been trying to play some sound(.wav) from a website link on windows phone 7 using the media element.
MediaElement mediaElement = new MediaElement();
mediaElement.source = new uri("http://api.microsofttranslator.com%2fwav");
mediaElement.play();
doesnt do anything.
i tried implementing handlers or even try to use the Webclient class to download the stream and play it but it has the same problem i dont hear anything.
and also i copied the uri to the browser and it played the wave i needed.
If you want to use Microsoft Translator, you can add a Service Reference to the API SOAP service. The Service Client exposes the SpeakAsync method which will return the URL of the WAV file. You can then use your WebClient or HttpWebRequest to download the stream and play it. There's example code in this blog post.