This is a migrated thread and some comments may be shown as answers.

MediaPlayer Converter Error

5 Answers 56 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Lawrence
Top achievements
Rank 1
Lawrence asked on 22 Apr 2009, 10:52 PM
Hi all,

I know SL3 is still in beta preventing so support is limited, however I wanted to point out a runtime error that I is being thrown from the MediaPlayer.dll and that I cant access to fix.:)   Below is the error message I am getting along with the xaml and xaml.cs code.  Not sure if it matters or not, but I am using Prism and injecting views including the UserControl that hosts the MediaPlayer control.  I really like the media player so any workaround suggestions would be wonderful!  Thank you!

Microsoft JScript runtime error: Unhandled Error in Silverlight 2 Application Specified cast is not valid.   at Telerik.Windows.Controls.ItemsCountToIsEnabledConverter.Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
   at System.Windows.Data.BindingExpression.ConvertToTarget(Object value)
   at System.Windows.Data.BindingExpression.GetValue(DependencyObject d, DependencyProperty dp)
   at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isSetByStyle, Boolean isSetByBuiltInStyle, PropertyInvalidationReason reason)
   at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value)
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   at System.Windows.FrameworkElement.SetBinding(DependencyProperty dp, Binding binding)
   at Telerik.Windows.Controls.RadMediaPlayer.MediaElement_MediaOpened(Object sender, RoutedEventArgs e)
   at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName) 

XAML.CS

private

 

VideosViewModel model;

 

 

public VideosViewModel Model

 

{

 

get

 

{

 

return this.model;

 

}

 

set

 

{

 

this.model = value;

 

 

this.DataContext = model;

 

 

if (model != null && model.MediaCollection.Count() > 0)

 

{

 

foreach (var item in model.MediaCollection)

 

{

 

var imgs = new BitmapImage(new Uri(string.Concat(thumbPrefix, item.ThumbnailUrl)));

 

 

var src = new Uri(String.Format("{0}/{1}", streamPrefix, item.SourceUrl.Substring(11)));

 

player.Items.Add(

new RadMediaItem() { ImageSource = imgs, Source = src, Title = item.Title, Description = item.Description });

 

 

}

 

var v = player.Items;

 

 

var t = player.CurrentItem;

 

}

}

}


.XAML

<

 

UserControl x:Class="Verb.Modules.Showcase.Views.VideosPlayerView"

 

 

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

 

 

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

 

 

xmlns:media="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.MediaPlayer"

 

 

>

 

 

 

<Grid x:Name="LayoutRoot" Background="White">

 

 

 

<media:RadMediaPlayer x:Name="player" />

 

 

 

</Grid>

 

</

 

UserControl>

 



5 Answers, 1 is accepted

Sort by
0
Bobi
Telerik team
answered on 23 Apr 2009, 02:16 PM
Hello Lawrence,

Can you please explain in more details what is the structure of your application?
What version of the RadMediaPlayer.dll are you using?

Sincerely yours,
Boryana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Lawrence
Top achievements
Rank 1
answered on 24 Apr 2009, 06:28 AM
Hi Boryana,

The version of the MediaPlayer.dll is:  2009.1.327.1020.  Its the dll I received from downloading the SL3 rebuild you provided a few weeks ago. 

The structure of my application is as I mentioned--based on the prism framework where I am using view injection to inject various views during runtime.  I am not using the media player in a popup at all.  I am using the media player within a usercontrol that is injected into a region (ContentControl), that is itself injected into an ItemsControl with a StackPanel Orientation = Horiz.  The ItemsControl lives in a navigation:Page that is loaded into a navigation:Frame on the RootVisual. 

This probably isnt much help.  I do know that controls relying on traversing the visual tree based on logical parent/child relationships tend to hiccup every so often using view injection.  Observing the MediaPlayer visual the MediaPlayer properly lists the items I added in the playlist.  Once the play button is selected it appears to start buffering and then throws the error.  THe Source Uri provided to it points to a Silverlight Streaming account where I have videos stored.
0
Accepted
Miroslav
Telerik team
answered on 26 Apr 2009, 01:49 PM
Hi Lawrence,

Thanks for the detailed explanations!

It seems that the problem comes from a binding of the ChaptersPresenter that is not working in SL3.

Until the problem is fixed (the next SP at latest) you can remove the chapters presenter from the MediaPlayer template. This will mean that no chapters will be visible, but at least it will be running until we fix this.

I am sending you the default theme with a removed Chapters presenter (the commented-out xaml at the end of the file).

You can use the style like so:
<telerik:RadMediaPlayer  Style="{StaticResource customMpStyle}" /> 


Hopefully this will work for you,

Regards,
Miroslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Lawrence
Top achievements
Rank 1
answered on 26 Apr 2009, 11:48 PM
Thank you for the feedback Miroslav I wasnt certain whether the detail would be helpful.  I will try the new style with the chapters commented out and let you know how it goes.  Thanks again.
0
Lawrence
Top achievements
Rank 1
answered on 30 Apr 2009, 03:42 AM
Quick reply...the above workaround works great.  Thank you Miroslav!
Tags
General Discussions
Asked by
Lawrence
Top achievements
Rank 1
Answers by
Bobi
Telerik team
Lawrence
Top achievements
Rank 1
Miroslav
Telerik team
Share this question
or