在同一时间播放背景音频和视频都 [英] Playing background audio and video both at same time

查看:164
本文介绍了在同一时间播放背景音频和视频都的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要开发Windows Phone应用程序。在该页面中,我需要运行后台音频和视频不断(在重复模式)。

I need to develop windows phone application. In that in the page i need to run background audio and video continuously (in repeat mode).

有关音频,我发现这个例子

现在如何添加背景视频的网页?在页面我需要显示一些文本框和按钮,并在后台的视频和音频都将发挥。

Now how do i add background video in the page? In the page i need to show some textboxes and buttons and in the background video and audio both will play.

两者的音频和视频文件将被包括在该应用程序,即不需要汽蒸。

Both audio and video file will be included in the application i.e. no steaming is needed.

推荐答案

其实我这样做是为了我的工作任务了几个月回来。我发现对Silverlight的WP7并没有让我有两个MediaElements在同一时间播放。我所做的就是创建一个的Windows Phone Silverlight和XNA应用即可。
(现在的Silverlight WP7用于终于创造一个背景音频播放器,所以你可以做到这一点,如果你想这样)

I actually did this for a work assignment of mine a few months back. I found out that Silverlight for WP7 did not allow me to have two MediaElements playing at the same time. What I did was create a Windows Phone Silverlight and XNA Application. (Now Silverlight for WP7 finally created a background audio player so you can do it that way if you would like)

您的应用程序可以完全在Silverlight,但你可以使用XNA引用(你也可以有机会获得一个更新循环这是非常好的)

Your application can be entirely in Silverlight, but then you can use the XNA referenced (also you can have access to an update loop which is really nice)

XNA 有一个 SoundEffect中 SoundEffectInstance

然后加载声音只是做到以下几点:

Then to load a sound just do the following:

private SoundEffect Sound = null;
private SoundEffectInstance Instance = null;

在Sound.cs播放音效

Sound = ContentManager.Load<SoundEffect>(fileName); //ContentManager will have to be instantiated from wherever you create it.
Instance = Sound.CreateInstance();
Instance.Play();

然后,只需使用Silverlight的MediaElement的播放视频文件。

Then just use the Silverlight MediaElement to play your video file.

<MediaElement x:Name="VideoPlayer" AutoPlay="False" Width="320" Height="220"/>

codeBehind

VideoPlayer.Source = = new Uri("fileName", UriKind.Relative);
VideoPlayer.Play();

这篇关于在同一时间播放背景音频和视频都的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆