4 Replies - 3575 Views - Last Post: 18 January 2011 - 10:04 AM Rate Topic: -----

#1 Guest_Osro*


Reputation:

Attempting to control Web Browser sound levels

Posted 14 January 2011 - 09:49 PM

Ok, so I'm writing a windows forms app. where the goal is to have 2 tabs:
  • first tab: has sound board with different sound clips
  • second tab: uses a WebBrowser control to go to pandora.com to stream music


I've been able to accomplish this pretty easily, but here is my problem: When I play a sound from the sound board, I first want pandora to quickly fade out, then have the sound play, then have pandora fade back in. I'm not married to the idea of using pandora, or the WebBrowser control. Its just that we normally use Pandora, and I couldn't figure out any other way to stream it. If there was a way to connect to Pandora without using a WebBrowser, and would allow me to control the volume, this would be preferable.

Also, I understand I could fade out the system volume, stop the WebBrowser, and then restart Pandora, but completely stopping and starting new songs all the time would be awful, not to mention the lag time in reconnecting.


In case you're wondering or care, the app I'm writing is designed to control music while my friends and I play wiffle ball. Currently we just stream music on Pandora, but we want it so that when a new person comes up to bat, that person has entrance music. So, you hit a key, pandora fades out, that person's entrance music plays, then pandora fades back in. Any help would be much appreciated.
Osro
p.s. I'm a professional software developer with 4+ years experience, I can handle (and would greatly appreciate) any suggestions you've got.

Is This A Good Question/Topic? 0

Replies To: Attempting to control Web Browser sound levels

#2 Fungle   User is offline

  • D.I.C Regular
  • member icon

Reputation: 265
  • View blog
  • Posts: 337
  • Joined: 06-March 10

Re: Attempting to control Web Browser sound levels

Posted 15 January 2011 - 08:50 PM

I've never used or heard of Pandora.com [Seems to be restricted to just US] but if you find the url of the sound file, and change the web browser control's url to match it, surely that is what you want?

When you say fade out too, Do you mean visual or audio wise?

For switching tabs you can just use this method:
tabControl1.SelectTab("tabPage2");



Also, WebBrowser Control has many events for when a page is loaded like:
webBrowser1_Navigated

or
webBrowser1_DocumentCompleted 

That you could use.

This post has been edited by Fungle: 15 January 2011 - 08:56 PM

Was This Post Helpful? 0
  • +
  • -

#3 Core   User is offline

  • using System.Linq;
  • member icon

Reputation: 784
  • View blog
  • Posts: 5,101
  • Joined: 08-December 08

Re: Attempting to control Web Browser sound levels

Posted 15 January 2011 - 10:59 PM

How I see it, is you have to control mixer lines.

This involves heavy WinAPI, so here are some resources to get you started.

First of all, try looking at mixerLineGetInfo. If you aren't sure how to implement this in managed code, the best way to go is look at PInvoke for a basic implementation. The structs and signatures are well-documented there to be adapted to your project.
Was This Post Helpful? 0
  • +
  • -

#4 Guest_Osro*


Reputation:

Re: Attempting to control Web Browser sound levels

Posted 18 January 2011 - 10:02 AM

FYI- Pandora is a streaming music website. You tell it what music you enjoy, and then it proceeds to play music similar to that. I appreciate your suggestion, but it will not work in this case. Thanks anyway! :)

View PostFungle, on 15 January 2011 - 08:50 PM, said:

I've never used or heard of Pandora.com [Seems to be restricted to just US] but if you find the url of the sound file, and change the web browser control's url to match it, surely that is what you want?

When you say fade out too, Do you mean visual or audio wise?

For switching tabs you can just use this method:
tabControl1.SelectTab("tabPage2");



Also, WebBrowser Control has many events for when a page is loaded like:
webBrowser1_Navigated

or
webBrowser1_DocumentCompleted 

That you could use.

Was This Post Helpful? 0

#5 Guest_Osro*


Reputation:

Re: Attempting to control Web Browser sound levels

Posted 18 January 2011 - 10:04 AM

Core, thanks a lot for the suggestion, this sounds like what I need. I'll check it out!

View PostCore, on 15 January 2011 - 10:59 PM, said:

How I see it, is you have to control mixer lines.

This involves heavy WinAPI, so here are some resources to get you started.

First of all, try looking at mixerLineGetInfo. If you aren't sure how to implement this in managed code, the best way to go is look at PInvoke for a basic implementation. The structs and signatures are well-documented there to be adapted to your project.

Was This Post Helpful? 0

Page 1 of 1