Click here to Skip to main content
12,547,922 members (46,016 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB ASP.NET VB.NET media
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...

Imports WMPLib
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        Dim LocalFile As String = "C:\butp.mp3"
        Dim ServerFile As String = "D:\inetpub\Folder\Audio\butp.mp3"
Exit Sub
    Public Sub Play_Music(TrackName As String)
        Dim Player As New WindowsMediaPlayer()
        Player.URL = TrackName
        Player.settings.volume = 100
    End Sub
    Sub Clear_Media()
        Dim Player As New WindowsMediaPlayer()
    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!

Posted 9-Aug-12 20:24pm
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
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.
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!

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 ?
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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
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

So not 100% sure on what your talking about...
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

<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" />

Protected AudioFileURL As String
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    AudioFileURL = "Audio/butp.mp3"

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.161021.1 | Last Updated 16 Aug 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100