Skip to main content

Microsoft Silverlight

Answered Question media element and silverlight RSS Feed

(0)

TheRekz
TheRekz

Member

Member

4 points

40 Posts

media element and silverlight

 How do you create something like this with a media element?

http://narenda.com/silverlight/default.html

What I have so far is:

 

Canvas[] cI = new Canvas[9];
       
MediaElement[] me = new MediaElement[9];
         
int blockSizeW = 97;
       
int blockSizeH = 97;
 
int nx = 0;
           
for (int ix = 0; ix < 3; ix++)
               
for (int iy = 0; iy < 3; iy++)
               
{
                    nx
= (ix * 3) + iy;
                    me
[nx] = new MediaElement();
                    me
[nx].Height = 300;
                    me
[nx].Width = 300;
                    me
[nx].Stretch = Stretch.UniformToFill;
                   
RectangleGeometry r = new RectangleGeometry();
                    r
.Rect = new Rect((ix * blockSizeW), (iy * blockSizeH), blockSizeW, blockSizeH);
                    me
[nx].Clip = r;
                    me
[nx].Source = new Uri("assets/SharePoint.wmv", UriKind.Relative);
                    me
[nx].SetValue(Canvas.TopProperty, Convert.ToDouble(iy * blockSizeH * -1));
                    me
[nx].SetValue(Canvas.LeftProperty, Convert.ToDouble(ix * blockSizeW * -1));
                 
                    cI
[nx] = new Canvas();
                    cI
[nx].Width = blockSizeW;
                    cI
[nx].Height = blockSizeH;
                    cI
[nx].Children.Add(me[nx]);
                    cI
[nx].SetValue(Canvas.NameProperty, "C" + nx.ToString());
                    cI
[nx].MouseLeftButtonDown += new MouseButtonEventHandler(Page_MouseLeftButtonDown);
                   
if (nx < 8)
                       
GameContainer.Children.Add(cI[nx]);
               
}

 but it always gives me an error:

 

Error: Unhandled Error in Silverlight 2 Application SlidingBlocks.xap
Code: 4001   
Category: MediaError      
Message: AG_E_NETWORK_ERROR    
 

jay nanavati
jay nana...

Contributor

Contributor

3388 points

624 Posts

Answered Question

Re: media element and silverlight

Create folder "assets" in the ClientBin directory under SilverlightApplication.Web project, put your video in this folder. and set source like this:

Source="/assets/SharePoint.wmv"

Jay K Nanavaty
www.technologyopinion.com
Mark as answer if it helps. It will also help others...

brightstar
brightstar

Member

Member

406 points

185 Posts

Re: media element and silverlight

I haven't such error as the topic-starter had at http://narenda.com/silverlight/default.html

I have the next error:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; OfficeLiveConnector.1.3; OfficeLivePatch.0.0)
Timestamp: Tue, 7 Jul 2009 01:20:42 UTC


Message: Syntax error
Line: 1
Char: 1
Code: 0
URI: http://narenda.com/silverlight/default.xaml

jay nanavati
jay nana...

Contributor

Contributor

3388 points

624 Posts

Re: Re: media element and silverlight

Hi brightstar,

 I have checked the url but I am not getting any error in IE 7 ,IE8 or in Mozilla Firefox 3.

Jay K Nanavaty
www.technologyopinion.com
Mark as answer if it helps. It will also help others...
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities