夏天PLUS 2015-07-17 03:47 采纳率: 16.7%
浏览 1552

vs2012sliverlight 播放音频文件

我用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();
    }
}

}




  • 写回答

3条回答 默认 最新

  • 91program 博客专家认证 2015-07-17 03:52
    关注

    建议你先试试 Media Player 能不能播放这个 WMA 文件。

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器