Hi,
i am trying to play a .wav audio file which is stored in database,
but my problem is play button is not working...
please find the below sample code:
i have created one control (hfRadMediaPlayer) which is inherited from RadMediaPlayer :
<local:hfRadMediaPlayer x:Name="hfMediaPlayer" AutoPlay="False"
IsChaptersPanelHidden="True"
Header="{Binding RelativeSource={RelativeSource Self}, Path=MediaElement}"
VerticalContentAlignment="Top" HorizontalContentAlignment="Center"
SelectedIndex="0" IsChaptersPanelPinned="True">
<telerik:RadMediaItem x:Name="RadMediaItemAudio" IsStreamingSource="True" Header="Infinity Media Player" Height="150" Width="300">
<telerik:RadMediaChapter Content="Chapter 1" Position="00:00:50" Height="50" Width="100"/>
<telerik:RadMediaChapter Content="Chapter 2" Position="00:03:00" Height="50" Width="100"/>
</telerik:RadMediaItem>
</local:hfRadMediaPlayer>
exposed one Dependency Property to set source to SetSourcemethod:
public static readonly DependencyProperty SetSourceProperty = DependencyProperty.Register("SetSource",
typeof(MediaStreamSource), typeof(hfRadMediaPlayer), new PropertyMetadata(new PropertyChangedCallback(OnPropertyChanged)));
public MediaStreamSource SetSource
{
get
{
return (MediaStreamSource)this.GetValue(SetSourceProperty);
}
set
{
base.SetValue(SetSourceProperty, value);
this.MediaElement.SetSource(value);
}
}
setting the source like this:private void SetSourceContent(MediaStreamSource radDocument)
{
//if (radDocument == null)
//{
// this.Document = new RadMediaPlayer();
//}
//else
//{
if (this.MediaElement == null)
this.MediaElement = new MediaElement();
this.MediaElement.SetSource(radDocument);
//}
}
Thanks in advance
i am trying to play a .wav audio file which is stored in database,
but my problem is play button is not working...
please find the below sample code:
i have created one control (hfRadMediaPlayer) which is inherited from RadMediaPlayer :
<local:hfRadMediaPlayer x:Name="hfMediaPlayer" AutoPlay="False"
IsChaptersPanelHidden="True"
Header="{Binding RelativeSource={RelativeSource Self}, Path=MediaElement}"
VerticalContentAlignment="Top" HorizontalContentAlignment="Center"
SelectedIndex="0" IsChaptersPanelPinned="True">
<telerik:RadMediaItem x:Name="RadMediaItemAudio" IsStreamingSource="True" Header="Infinity Media Player" Height="150" Width="300">
<telerik:RadMediaChapter Content="Chapter 1" Position="00:00:50" Height="50" Width="100"/>
<telerik:RadMediaChapter Content="Chapter 2" Position="00:03:00" Height="50" Width="100"/>
</telerik:RadMediaItem>
</local:hfRadMediaPlayer>
exposed one Dependency Property to set source to SetSourcemethod:
public static readonly DependencyProperty SetSourceProperty = DependencyProperty.Register("SetSource",
typeof(MediaStreamSource), typeof(hfRadMediaPlayer), new PropertyMetadata(new PropertyChangedCallback(OnPropertyChanged)));
public MediaStreamSource SetSource
{
get
{
return (MediaStreamSource)this.GetValue(SetSourceProperty);
}
set
{
base.SetValue(SetSourceProperty, value);
this.MediaElement.SetSource(value);
}
}
setting the source like this:private void SetSourceContent(MediaStreamSource radDocument)
{
//if (radDocument == null)
//{
// this.Document = new RadMediaPlayer();
//}
//else
//{
if (this.MediaElement == null)
this.MediaElement = new MediaElement();
this.MediaElement.SetSource(radDocument);
//}
}
Thanks in advance