Exemplo n.º 1
0
        /// <summary>
        /// View video
        /// </summary>
        private void ViewVideo()
        {
            //media details
            int    mediaId = obj.mediaId;
            string uri     = obj.uri;
            int    _top    = obj.top;
            int    _left   = obj.left;

            string _filePath = Uri.UnescapeDataString(uri).Replace('+', ' ');
            Uri    uriVideo  = new Uri(uri);

            duration = obj.duration;
            if (duration == 0)
            {
                TimeSpan videoDuration = PlayerSettings.GetVideoDuration(_filePath);
                duration = videoDuration.TotalSeconds;
            }

            //transition IN details
            string transIn          = obj.transIn;
            string transInDirection = obj.transInDirection;
            double transInDuration  = obj.transInDuration;

            duration += (transInDuration / 1000);

            //transition OUT details
            string transOut          = obj.transOut;
            string transOutDirection = obj.transOutDirection;
            double transOutDuration  = obj.transOutDuration;

            duration += (transOutDuration / 1000);

            medaiElemnt        = new MediaElement();
            medaiElemnt.Source = uriVideo;
            int volume = 0;

            if (obj.mute == 1)
            {
                volume = 0;
            }
            else
            {
                volume = 100;
            }
            medaiElemnt.Volume = volume;
            if (obj.loop == 1)
            {
                medaiElemnt.MediaEnded += MedaiElemnt_MediaEnded;
            }

            this.videoPanel.Children.Add(medaiElemnt);

            TimerMediaVideo          = new System.Timers.Timer();
            TimerMediaVideo.Elapsed += new ElapsedEventHandler(MediaTimer_Tick);
            TimerMediaVideo.Interval = 1000 * duration;
            TimerMediaVideo.Start();

            if (transIn != null)
            {
                MediaSupport.MoveAnimation(medaiElemnt, OpacityProperty, transIn, transInDirection, transInDuration, "in", _top, _left);
            }
            double transOutStartTime = duration - (transOutDuration / 1000);

            if (transOut != null)
            {
                var timerTransition = new DispatcherTimer {
                    Interval = TimeSpan.FromSeconds(transOutStartTime)
                };
                timerTransition.Start();
                timerTransition.Tick += (sender1, args) =>
                {
                    timerTransition.Stop();
                    MediaSupport.MoveAnimation(medaiElemnt, OpacityProperty, transOut, transOutDirection, transOutDuration, "out", _top, _left);
                };
            }
        }
Exemplo n.º 2
0
        private void RenderImage()
        {
            //media details
            int    mediaId = obj.mediaId;
            string uri     = obj.uri;

            Uri    uriImage  = new Uri(uri);
            string _filePath = Uri.UnescapeDataString(uri).Replace('+', ' ');

            int _top  = obj.top;
            int _left = obj.left;

            duration = obj.duration;

            //transition IN details
            string transIn          = obj.transIn;
            string transInDirection = obj.transInDirection;
            double transInDuration  = obj.transInDuration;

            duration += (transInDuration / 1000);

            //transition OUT details
            string transOut          = obj.transOut;
            string transOutDirection = obj.transOutDirection;
            double transOutDuration  = obj.transOutDuration;

            duration += (transOutDuration / 1000);

            img = new Image()
            {
                Name = "Img" + obj.regionId,
            };

            img.Source = new BitmapImage(uriImage);

            this.ImagePanel.Children.Add(img);


            TimerMediaImg          = new System.Timers.Timer();
            TimerMediaImg.Elapsed += new ElapsedEventHandler(MediaTimerImg_Tick);
            TimerMediaImg.Interval = 1000 * duration;
            TimerMediaImg.Start();

            if (transIn != null)
            {
                MediaSupport.MoveAnimation(img, OpacityProperty, transIn, transInDirection, transInDuration, "in", _top, _left);
            }
            double transOutStartTime = duration - (transOutDuration / 1000);

            if (transOut != null)
            {
                var timerTransition = new DispatcherTimer {
                    Interval = TimeSpan.FromSeconds(transOutStartTime)
                };
                timerTransition.Start();
                timerTransition.Tick += (sender1, args) =>
                {
                    timerTransition.Stop();
                    MediaSupport.MoveAnimation(img, OpacityProperty, transOut, transOutDirection, transOutDuration, "out", _top, _left);
                };
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// View web site
        /// </summary>
        private void ViewWeb()
        {
            string _regionID = obj.regionId;
            //media details
            int    mediaId = obj.mediaId;
            string modeId  = obj.modeid;
            int    _top    = obj.top;
            int    _left   = obj.left;

            string _filePath  = "";
            bool   nativeOpen = modeId != string.Empty && modeId == "1";
            string url        = obj.uri;

            if (nativeOpen)
            {
                // If we are modeid == 1, then just open the webpage without adjusting the file path
                _filePath = Uri.UnescapeDataString(obj.uri).Replace('+', ' ');
            }
            else
            {
                // Set the file path
                _filePath = PlayerSettings.libraryPath + mediaId + ".htm";
            }

            duration = MediaSupport.ReadControlMetaDuration(_filePath);
            if (duration == 0)
            {
                duration = obj.duration;
            }

            //transition IN details
            string transIn          = obj.transIn;
            string transInDirection = obj.transInDirection;
            double transInDuration  = obj.transInDuration;

            duration += (transInDuration / 1000);

            //transition OUT details
            string transOut          = obj.transOut;
            string transOutDirection = obj.transOutDirection;
            double transOutDuration  = obj.transOutDuration;

            duration += (transOutDuration / 1000);

            web = new ChromiumWebBrowser()
            {
                Name = "region" + _regionID
            };

            if (PlayerSettings.firstLoadCheck == 0)
            {
                var timer = new DispatcherTimer {
                    Interval = TimeSpan.FromSeconds(2)
                };
                timer.Start();
                timer.Tick += (sender1, args) =>
                {
                    timer.Stop();
                    web.Address = _filePath;
                };
            }
            else
            {
                this.Dispatcher.Invoke(() =>
                {
                    web.Address = _filePath;
                });
            }

            this.webPanel.Children.Add(web);

            TimerMedia          = new System.Timers.Timer();
            TimerMedia.Elapsed += new ElapsedEventHandler(webtimer_Tick);
            TimerMedia.Interval = 1000 * duration;
            TimerMedia.Start();

            //transition IN render
            if (transIn != null)
            {
                MediaSupport.MoveAnimation(web, OpacityProperty, transIn, transInDirection, transInDuration, "in", _top, _left);
            }

            ////transition OUT render
            double transOutStartTime = duration - (transOutDuration / 1000);

            if (transOut != null)
            {
                var timerTransition = new DispatcherTimer {
                    Interval = TimeSpan.FromSeconds(transOutStartTime)
                };
                timerTransition.Start();
                timerTransition.Tick += (sender1, args) =>
                {
                    timerTransition.Stop();
                    MediaSupport.MoveAnimation(web, OpacityProperty, transOut, transOutDirection, transOutDuration, "out", _top, _left);
                };
            }
        }
Exemplo n.º 4
0
        private void ViewFlash()
        {
            string _regionID = obj.regionId;
            //media details
            int    mediaId = obj.mediaId;
            string modeId  = obj.modeid;

            int _top  = obj.top;
            int _left = obj.left;

            string _filePath  = "";
            bool   nativeOpen = modeId != string.Empty && modeId == "1";


            _filePath = obj.uri;

            duration = obj.duration;

            string flashWeb = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0'  id='analog_clock' align='middle'>";

            flashWeb += "<param name='allowScriptAccess' value='sameDomain' />";
            flashWeb += "<param name='movie' value='" + _filePath + "' />";
            flashWeb += "<param name='quality' value='high' />";
            flashWeb += "<param name='bgcolor' value='#000' />";
            flashWeb += "<param name='WMODE' value='transparent' />";
            flashWeb += "<embed src='" + _filePath + "' quality='high' wmode='transparent' bgcolor='#ffffff' width='" + obj.width + "' height='" + obj.height + "' name='analog_clock' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
            flashWeb += "</object>";

            string temSavePath = PlayerSettings.libraryPath + "temp" + mediaId + ".htm";

            using (FileStream fs = new FileStream(temSavePath, FileMode.Create))
            {
                using (StreamWriter w = new StreamWriter(fs, Encoding.UTF8))
                {
                    w.WriteLine(flashWeb);
                }
            }

            Uri uriFlash = new Uri(temSavePath);

            //transition IN details
            string transIn          = obj.transIn;
            string transInDirection = obj.transInDirection;
            double transInDuration  = obj.transInDuration;

            duration += (transInDuration / 1000);

            //transition OUT details
            string transOut          = obj.transOut;
            string transOutDirection = obj.transOutDirection;
            double transOutDuration  = obj.transOutDuration;

            duration += (transOutDuration / 1000);

            web = new ChromiumWebBrowser()
            {
                Name = "region" + _regionID
            };
            web.Address = temSavePath;

            TimerMediaFlash          = new System.Timers.Timer();
            TimerMediaFlash.Elapsed += new ElapsedEventHandler(Flashtimer_Tick);
            TimerMediaFlash.Interval = 1000 * duration;
            TimerMediaFlash.Start();

            this.FlashPanel.Children.Add(web);

            if (transIn != null)
            {
                MediaSupport.MoveAnimation(web, OpacityProperty, transIn, transInDirection, transInDuration, "in", _top, _left);
            }

            double transOutStartTime = duration - (transOutDuration / 1000);

            if (transOut != null)
            {
                var timerTransition = new DispatcherTimer {
                    Interval = TimeSpan.FromSeconds(transOutStartTime)
                };
                timerTransition.Start();
                timerTransition.Tick += (sender, args) =>
                {
                    timerTransition.Stop();
                    MediaSupport.MoveAnimation(web, OpacityProperty, transOut, transOutDirection, transOutDuration, "out", _top, _left);
                };
            }
        }