如何在Windows Phone中使用缓冲进度指示器从远程服务器播放铃声? [英] How to play ringtone from remote server with buffering progress indicator in windows phone?

查看:62
本文介绍了如何在Windows Phone中使用缓冲进度指示器从远程服务器播放铃声?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试为Windows Phone 8开发铃声应用。铃声是从远程服务器加载的。当点击预览按钮时,显示加载指示,然后在一段时间后成功播放声音并且加载指示器变为不可见。

但是只有一个音频文件加载指示器仍然可见(虽然声音正在播放)。

我调试BufferingProgressChanged并发现这样的最大BufferingProgress值0.300304。

如果这就是加载指示器仍然可见的原因。我该怎么办?请建议我。



I've been trying to develop a ringtone app for windows phone 8. Ringtone are loaded from remote server. when preview button is tapped on, loading indicator is shown then after sometime play sound successfully and loading indicator goes to invisible.
But only for one audio file loading indicator remain visible (though sound is playing).
I debug BufferingProgressChanged and found maximum BufferingProgress value 0.300304 like this.
If that's why loading indicator remain visible. Now how should i do??? please suggest me.

<pre lang="c#"><pre lang="c#">

RingtoneClass selectedRingtone = null;

RingtoneClass selectedRingtone = null;

<pre lang="text"><pre lang="text"><pre lang="text"><pre lang="text">



MediaElement myRingtonePalyer = new MediaElement();

private void playButton_Tap(object sender,System.Windows.Input.GestureEventArgs e)

{

myRingtonePalyer.BufferingProgressChanged + = myRingtonePalyer_BufferingProgressChanged;

soundLoading.Visibility = Visibility.Visible;

var element =(FrameworkElement)sender;

selectedRingtone =(Ringtone)element.DataContext;

myRingtonePalyer.Source = new Uri(selectedRin gtone.Source,UriKind.RelativeOrAbsolute);

myRingtonePalyer.Play();



}



private void myRingtonePalyer_BufferingProgressChanged(object sender,RoutedEventArgs e)

{

MediaElement m =发送者为MediaElement;

double progressValue = m.BufferingProgress;

如果progressValue> = 1)

{

soundLoading.Visibility = Visibility.Collapsed;

}

}


MediaElement myRingtonePalyer = new MediaElement();
private void playButton_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
myRingtonePalyer.BufferingProgressChanged += myRingtonePalyer_BufferingProgressChanged;
soundLoading.Visibility = Visibility.Visible;
var element = (FrameworkElement)sender;
selectedRingtone = (Ringtone)element.DataContext;
myRingtonePalyer.Source = new Uri(selectedRingtone.Source, UriKind.RelativeOrAbsolute);
myRingtonePalyer.Play();

}

private void myRingtonePalyer_BufferingProgressChanged(object sender, RoutedEventArgs e)
{
MediaElement m = sender as MediaElement;
double progressValue = m.BufferingProgress;
if progressValue>= 1)
{
soundLoading.Visibility = Visibility.Collapsed;
}
}

推荐答案

这篇关于如何在Windows Phone中使用缓冲进度指示器从远程服务器播放铃声?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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