Example #1
0
    private void SetMediaItem(ref System.Web.UI.SilverlightControls.MediaPlayer SLP)
    {
        MediaItems mi = new MediaItems();

        System.Web.UI.SilverlightControls.MediaChapter mc;
        try
        {
            // get Media item from XML
            mi.GetMediaItem();

            // set Media source
            SLP.MediaSource       = mi.MediaSource;
            SLP.PlaceholderSource = mi.PlaceholderSource;

            // add Chapters
            if (mi.Chapters.Count > 0)
            {
                for (int i = 0; i < mi.Chapters.Count; i++)
                {
                    mc                 = new System.Web.UI.SilverlightControls.MediaChapter();
                    mc.Position        = mi.Chapters[i].Position;
                    mc.ThumbnailSource = mi.Chapters[i].ThumbnailSource;
                    mc.Title           = mi.Chapters[i].Title;
                    SLP.Chapters.Add(mc);
                    mc = null;
                }
            }
        }
        catch { }
        finally { mi = null; mc = null; }
    }
Example #2
0
    private void PlayerInit(ref System.Web.UI.SilverlightControls.MediaPlayer SLP)
    {
        SLMediaPlayer slm;

        try
        {
            // read setting from XML file
            slm = new SLMediaPlayer();
            slm.GetPlayer();

            // assign values to Silverlight Media Player
            SLP.Width  = slm.Width;
            SLP.Height = slm.Height;

            SLP.AutoLoad = slm.AutoLoad;
            SLP.AutoPlay = slm.AutoPlay;

            // read from XML and set player scale mode
            switch (slm.ScaleMode)
            {
            case "stretch":
                SLP.ScaleMode = System.Web.UI.SilverlightControls.ScaleMode.Stretch;
                break;

            case "zoom":
                SLP.ScaleMode = System.Web.UI.SilverlightControls.ScaleMode.Zoom;
                break;

            case "none":
                SLP.ScaleMode = System.Web.UI.SilverlightControls.ScaleMode.None;
                break;

            default: break;
            }
        }
        catch { }
        finally { slm = null; }
    }