播放媒体-VB.Net [英] Playing Media - VB.Net
问题描述
大家好,
我正在编写一个可以给出指示的应用程序,然后播放带有该指示的音轨...在测试时,它可以在本地PC上正常运行,但是一旦将其放到Web服务器上,就可以了.去...没有错误就没有声音播放...
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
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
我有两个字符串用于测试和生产之间的不同位置...我已将"Windows桌面体验"加载到包含Windows Media Player的所有DLL的Web服务器上,并启用了Windows音频服务还是一无所有...任何建议都很好!
Caz
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
推荐答案
如前所述,您需要将IIS设置为服务器mp3.您还需要确保文件位于Web应用程序文件夹中,因为IIS无法在其上方看到它们.
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.
在您的Web项目中创建一个文件夹(视频")
将所有视频存储在该文件夹(视频")中,然后在本地计算机上播放视频
如果视频播放比发布您的网站并检查天气是否适合您播放视频
我以为您的视频发布时并没有完美的路径
在发布后付款时,插入一个标签进行测试并检查视频的路径
这样您就可以简要了解
请不要传递视频路径(将Dim ServerFile作为字符串="http://website/Audio/butp.mp3")
给出发布文件夹(视频")的路径
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
<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>
Protected AudioFileURL As String
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
AudioFileURL = "Audio/butp.mp3"
这篇关于播放媒体-VB.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!