diff --git a/widget/src/cocoa/nsSound.h b/widget/src/cocoa/nsSound.h index e0711b2e29fb..94a166b9ab20 100644 --- a/widget/src/cocoa/nsSound.h +++ b/widget/src/cocoa/nsSound.h @@ -21,6 +21,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Stuart Parmenter * Vladimir Vukicevic * * Alternatively, the contents of this file may be used under the terms of @@ -48,12 +49,12 @@ class nsSound : public nsISound, { public: - nsSound(); - virtual ~nsSound(); + nsSound(); + virtual ~nsSound(); - NS_DECL_ISUPPORTS - NS_DECL_NSISOUND - NS_DECL_NSISTREAMLOADEROBSERVER + NS_DECL_ISUPPORTS + NS_DECL_NSISOUND + NS_DECL_NSISTREAMLOADEROBSERVER }; #endif diff --git a/widget/src/cocoa/nsSound.mm b/widget/src/cocoa/nsSound.mm index 6a7fc2714524..40cc7694a42d 100644 --- a/widget/src/cocoa/nsSound.mm +++ b/widget/src/cocoa/nsSound.mm @@ -21,6 +21,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Stuart Parmenter * Vladimir Vukicevic * * Alternatively, the contents of this file may be used under the terms of @@ -39,6 +40,13 @@ #include "nsSound.h" +#include +#include + +#include "nsNetUtil.h" +#include "nsCOMPtr.h" +#include "nsIURL.h" + NS_IMPL_ISUPPORTS1(nsSound, nsISound) nsSound::nsSound() @@ -62,13 +70,23 @@ nsSound::OnStreamComplete(nsIStreamLoader *aLoader, PRUint32 dataLen, const PRUint8 *data) { + NSData *value = [NSData dataWithBytes:data length:dataLen]; + + NSSound *sound = [[NSSound alloc] initWithData:value]; + + [sound play]; + + [sound autorelease]; + return NS_OK; } NS_IMETHODIMP nsSound::Play(nsIURL *aURL) { - return NS_OK; + nsCOMPtr uri(do_QueryInterface(aURL)); + nsCOMPtr loader; + return NS_NewStreamLoader(getter_AddRefs(loader), uri, this); } NS_IMETHODIMP