我用vs2012sliverlight 播放wma文件,按照silverlight从入门到精通 关于媒体播放mediaelement的使用,步骤一样,可是浏览器无法播放,运行时没有提示出错???
声音文件已经添加到工程目录,MediaElement设置为“永远复制”,“RESOURCE”
```
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<StackPanel Orientation="Vertical">
<MediaElement x:Name="mediaplay" HorizontalAlignment="Left"
Height="100" VerticalAlignment="Top" Width="100" Source="ALARM.WAV"/>
<StackPanel Orientation="Horizontal">
<Button x:Name="play" Content="播放" Height="100" Width="100" Click="play_Click"/>
</StackPanel>
</StackPanel>
</Grid>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace AlarmVoice
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
private void play_Click(object sender, RoutedEventArgs e)
{
mediaplay.Play();
}
}
}