Click here to Skip to main content
15,894,172 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hey all,

I am writing an application that will give directions and then play an audio track with the directions on there... It works fine on my local PC when I am testing, but as soon as I put it onto my web server... No go... No errors just no sound plays...

VB
Imports WMPLib
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        Clear_Media()

        Dim LocalFile As String = "C:\butp.mp3"
        Dim ServerFile As String = "D:\inetpub\Folder\Audio\butp.mp3"

Play_Music(ServerFile)

Exit Sub

    Public Sub Play_Music(TrackName As String)
        Dim Player As New WindowsMediaPlayer()
        Player.URL = TrackName
        Player.settings.volume = 100
        Player.controls.play()

    End Sub

    Sub Clear_Media()
        Dim Player As New WindowsMediaPlayer()
        Player.close()

    End Sub


I have the two strings for the differing places between testing and production... I have loaded the "Windows Desktop Experience" onto my web server which contains all of the DLL's for Windows Media Player, I have enabled the Windows Audio Service and still nothing... Any advice would be great!

Caz
Posted
Comments
dhavalmore13986 11-Aug-12 2:59am    
if your video play in local machine
then you have to configure ISS settings
in ISS give mime types ("mp3")
and check weather its working or not

As was said, you need to set up IIS to server mp3s. You also need to make sure your files are inside the web application folders, as IIS cannot see above them.
 
Share this answer
 
Comments
Zac Newman 13-Aug-12 19:49pm    
It is not the MIME type that would be stopping it. I have now changed how I am passing the audio file to take the issue of file permissions out of it

Dim ServerFile As String = "http://website/Audio/butp.mp3"

Which browses fine... but still no go on the playing!

Caz
Christian Graus 16-Aug-12 13:35pm    
Either way, this is VBSCript so it would only work in IE. Why not write code that works in all browsers ?
Zac Newman 16-Aug-12 20:07pm    
In an organization you code with what you are asked to code with. And it is VB.Net as it says in the topic line... If you didn't know that is a completely different language... And as it runs on the server... Browser support is varied as it is for all code.
Christian Graus 16-Aug-12 21:03pm    
Oh. In that case, it's never going to work. Unless the goal is to play audio files on the server ?
make one folder in your web project("video")
store all videos in that folder("video"),after that play video on local machine
if video play than publish your website and check weather your video playing or not

I thought your video not getting perfect path when you publish
insert one label for test and check the path of the video when you paying after publish
so you can get brief idea

please don't pass video path ("Dim ServerFile As String = "http://website/Audio/butp.mp3"")

give publish folder ("video") path
 
Share this answer
 
Comments
Zac Newman 14-Aug-12 2:49am    
Umm... I am not sure where you are getting video from.
Passing the AUDIO file as a url was a proof of concept to rule out NTFS security issues in loading it into the website.
I have tried UNC, Local and URL
\\Server\Website$\Folder\File.mp3
D:\website\folder\file.mp3
http://website/folder/file.mp3

So not 100% sure on what your talking about...
HTML
<object classid='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95' id='MediaPlayer1' height="0" width="0">
    <param name="Filename" value="<%= Me.AudioFileURL %>" />
    <param name="ShowControls" value="False" />
    <param name="ShowAudioControls" value="False" />
    <param name="ShowDisplay" value="False" />
    <param name="DisplayMode" value="-1" />
    <param name="uiMode" value="invisible" />
</object>


VB
Protected AudioFileURL As String

Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load

    AudioFileURL = "Audio/butp.mp3"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900