how to use play sound
-
I will like to play sound when the current page load. I found a code but when i run on my application. The sound didnt play but i hear sound like 'de' instead of my own wav sound. What wrong? Partial Class tutorial Inherits System.Web.UI.Page Dim mrdrreader As SqlDataReader Dim mycommand As SqlCommand Public Class SoundClass Declare Auto Function PlaySound Lib "winmm.dll" (ByVal name As String, ByVal hmod As Integer, ByVal flags As Integer) As Integer ' name specifies the sound file when the SND_FILENAME flag is set. ' hmod specifies an executable file handle. ' hmod must be Nothing if the SND_RESOURCE flag is not set. ' flags specifies which flags are set. ' The PlaySound documentation lists all valid flags. Public Const SND_SYNC = &H0 ' play synchronously Public Const SND_ASYNC = &H1 ' play asynchronously Public Const SND_FILENAME = &H20000 ' name is file name Public Const SND_RESOURCE = &H40004 ' name is resource name or atom Public Sub PlaySoundFile(ByVal filename As String) ' Plays a sound from filename. PlaySound("c:/Inetup/wwwroot/fyp/sounds/newemail.wav", 0, SND_ASYNC) End Sub End Class Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim SoundInst As New SoundClass() SoundInst.PlaySoundFile("c:/Inetup/wwwroot/fyp/sounds/newemail.wav") : :end class
-
I will like to play sound when the current page load. I found a code but when i run on my application. The sound didnt play but i hear sound like 'de' instead of my own wav sound. What wrong? Partial Class tutorial Inherits System.Web.UI.Page Dim mrdrreader As SqlDataReader Dim mycommand As SqlCommand Public Class SoundClass Declare Auto Function PlaySound Lib "winmm.dll" (ByVal name As String, ByVal hmod As Integer, ByVal flags As Integer) As Integer ' name specifies the sound file when the SND_FILENAME flag is set. ' hmod specifies an executable file handle. ' hmod must be Nothing if the SND_RESOURCE flag is not set. ' flags specifies which flags are set. ' The PlaySound documentation lists all valid flags. Public Const SND_SYNC = &H0 ' play synchronously Public Const SND_ASYNC = &H1 ' play asynchronously Public Const SND_FILENAME = &H20000 ' name is file name Public Const SND_RESOURCE = &H40004 ' name is resource name or atom Public Sub PlaySoundFile(ByVal filename As String) ' Plays a sound from filename. PlaySound("c:/Inetup/wwwroot/fyp/sounds/newemail.wav", 0, SND_ASYNC) End Sub End Class Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim SoundInst As New SoundClass() SoundInst.PlaySoundFile("c:/Inetup/wwwroot/fyp/sounds/newemail.wav") : :end class
Hi LovelyHelp :) You can't play a sound on the clientside (in the visitor's browser) in this way. This piece of code would play the sound on the server instead. The only way you can play a sound on the client side, is by embedding a soundfile in the webpage. This can be done using WAV, MP3, Flash or other products. Links:
Kind regards - Jakob :cool: Three kinds of people in the world: - Those who can count.. - Those who can't!