0

I'm creating a tool to scrape and search the Amazon music database, it then cross references with google to display a bunch of information about the songs. One thing I want to add if possible, is to play the sound from the form using the media link scraped form amazons webpage.

This is the media link:

https://d2q1srilgjznst.cloudfront.net/64%2F30%2F232646106_S64.mp3?response-content-type=audio%2Fmpeg&Expires=1534727161&Signature=HF~qj5XP2WRKBJlT0VT1hDIq4cieH7SWcgnxRUGWm045iqIV4L7YTxlLihQdde9ZNrL97xf8zkfatRn-YxGYh0Yk1RmCHHI6H53j1wjig36KsHPdlnwoEp7qM45NsNhYf4IfXXjHzQ-tnkDfocpFSHMqss9FosYXWCf9qGrWKTo_&Key-Pair-Id=APKAJVZTZLZ7I5XDXGUQ

I have already scraped the data needed, I just am unsure how I can go about playing this on my C# application?

I don't have any code to show as searching on google I couldn't find a single thing relevant to this, or if its even possible. The closest I found was this, for playing media files.

System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"");
 player.Play();

The other question is for MP3 files, this is for data sourced online.

user3717174
  • 111
  • 9
  • Did you look at the SoundPlayer class? It contains an overload for a stream or a file path. https://learn.microsoft.com/en-us/dotnet/api/system.media.soundplayer?redirectedfrom=MSDN&view=netframework-4.7.2 – Jason Bayldon Aug 19 '18 at 01:42
  • Possible duplicate of [Playing a MP3 file in a WinForm application](https://stackoverflow.com/questions/15025626/playing-a-mp3-file-in-a-winform-application) – Jimi Aug 19 '18 at 02:05
  • If the Web resource can be streamed (as the one you linked here), you can directly assing the resource URI to the `WMPLib.WindowsMediaPlayer` `URL` property and play it with `Player.controls.play()`. Otherwise, you need to download the file first. – Jimi Aug 19 '18 at 02:07
  • 1
    The `SoundPlayer` class linked by @Jason Bayldon can only play `.wav` files. – Jimi Aug 19 '18 at 02:08
  • @Jimi yes, good call – Jason Bayldon Aug 19 '18 at 04:03
  • Hi, Thanks. I have never heard of WMPLib.WindowsMediaPlayer. Can't seem to find the reference for it in my VS either, Google says to add it as reference but i have no WMPLib. When I can figure out how to access it I'll let you know if it worked :) – user3717174 Aug 19 '18 at 04:08
  • Assuming that with *forms* you mean `WinForms`, you can add a: `References → COM → Windows Media Player`. If you find more than one reference there under the same name, choose the one with the higher file version. Maybe @Jason Bayldon can assist you here, providing an answer to your question if required. – Jimi Aug 19 '18 at 04:17

0 Answers0