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.
Related
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.
I Develop windows phone application and i want to stream audio from sound cloud without using sound cloud API ( i write this Code
"webBrowser1.NavigateToString("<!doctype html>" + "<html><head><title></title></head><body>" + "<iframe height=\"1000\" src=\"https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/125791854\" width=\"1200\"></iframe>" + "</body></html>");"
and C# and using web Browser Control In Xaml Page in but when i Run it it load sound cloud site but the audio didn't run.
Try Background Audio Player, here is a sample , basically what you will end up doing is
new AudioTrack(new Uri("[your soundcloud uri]", UriKind.Absolute), "[Track Name]", "[Artist]", "[Album]", null)
Things to note :
Url should be something like : http://api.soundcloud.com/tracks/[trackNo]/stream?client_id=[id]
You need to wait for the PlayerState to change to track ready and then call .Play(), This is due to the asynchronous nature of the background audio player. It actually resides in a different process than the rest of the code.
Im trying to play a video clip in my Silverlight Application.
var video_path = "http://mydomain.com/path-to-media/file.wmv";
mediaPlayer.AutoPlay = true;
mediaPlayer.Source = new Uri(video_path);
mediaPlayer.Play();
MessageBox.Show(mediaPlayer.Source.ToString()); //test the source string
But the video does not start or even display.
Is there a step I have forgotten ?
mediaPlayer is a simple Silverlight MediaElement
Update
When I attach a media Failed event and display the error exception i get
4001 AG_E_NETWORK_ERROR
It's because your silverlight application has a different URL scheme, and cross-scheme access is not allowed for media.
If the video URL starts from http://, your application URL should start from http:// too.
I think your application URL looks something like file:///C:/project/page.html. If so, you should add a ASP.Net website to your solution and host your Silverlight application there so that your URL looks like http://localhost:25252/page.html.
I am using VLC plugin to run an rtsp stream. The stream works good. But I want to store these videos to a file destination. I use this code but does not work.
axVLCPlugin21.playlist.add("rtsp://192.168.10.222:554/h264", null, ":sout=#transcode{vcodec=theo,vb=800,acodec=flac,ab=128,channels=2,samplerate=44100}:file{dst=C:\\123.ogg,no-overwrite} :sout-keep");
axVLCPlugin21.playlist.play();
This code only plays the rtsp stream but does not store. However, the same options can be used to stream directly on the VLC player.
Try using this Option for Storing Videos and displaying videos simultaneously
original commad to play in vlc
%vlc path% vlc.exe -vvv rtsp://192.168.10.22:554/h264 :sout=#transcode{vcodec=theo,vb=800,acodec=flac,ab=128,channels=2,samplerate=44100}:duplicate{dst=file{dst=C:\\\\123.mp4},dst=display}:sout-keep
if this works try to use
:sout=#transcode{vcodec=theo,vb=800,acodec=flac,ab=128,channels=2,samplerate=44100}:duplicate{dst=file{dst=C:\\\\123.mp4},dst=display}:sout-keep
":sout=#transcode{vcodec=theo,vb=800,acodec=flac,ab=128,channels=2,samplerate=44100}:file{dst=C:\123.ogg,no-overwrite} :sout-keep
also try to work in VLC gui by using streaming option+displaylocally+dst=file
Refrence:HowTo Receive and Save a Stream
VLC does not support recording of streams via plugin. Check this Link
I got a work around for it. I record the stream by calling the VLC directly. However, the player is hidden. I use this code:
Process.Start("C://Program Files//Videolan//VLC//VLC.exe","\"rtsp://xxx.xxx.xxx.xxx:554/h264\" --qt-start-minimized --sout=#transcode{vcodec=theo,vb=800,acodec=flac,ab=128,channels=2,samplerate=44100}:file{dst=C:\\123.ogg,no-overwrite}");
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);