Exemple #1
0
        protected string LoadSample(string information)
        {
            int sampleNumber = 0;

            if (Int32.TryParse(information.ToLower().Replace("sample", ""), out sampleNumber))
            {
                return(HelperClass.HostChanger(HelperClass.StringEncoderDecoder(ConfigurationManager.AppSettings["SampleVideo" + sampleNumber], StringConversionMode.Decode)));
            }
            else
            {
                return(HelperClass.HostChanger(HelperClass.StringEncoderDecoder(ConfigurationManager.AppSettings["SampleVideo1"], StringConversionMode.Decode)));
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            CSSLoader();

            if (Request.QueryString["displaypreload"] == "true")
            {
                PreloadBufferGenerator(true);
            }
            else
            {
                PreloadBufferGenerator();
            }

            if (!IsPostBack)
            {
                PageImageLoader();
                PageThemeLoader();
            }

            if (Request.QueryString.Count != 0)
            {
                if (Request.QueryString["new"] == "true")
                {
                    if (ConfigurationManager.AppSettings["overridehost"] == "true")
                    {
                        VideoURL = HelperClass.HostChanger(Request.QueryString["path"]);
                    }
                    else
                    {
                        VideoURL = Request.QueryString["path"];
                    }
                    if (Request.QueryString["mode"] != null)
                    {
                        if (Request.QueryString["mode"] == "upload")
                        {
                            try
                            {
                                videoFileName = HelperClass.StringEncoderDecoder(HttpUtility.UrlDecode(Request.QueryString["name"]), StringConversionMode.Decode);
                            }
                            catch (Exception err)
                            {
                                //Response.Redirect("Error.aspx?id=31");
                                videoFileName = "(Name conversion fail) " + HttpUtility.UrlDecode(Request.QueryString["name"]);
                            }
                        }
                        else
                        {
                            videoFileName = Request.QueryString["name"];
                        }
                    }
                    else
                    {
                        videoFileName = Request.QueryString["name"];
                    }

                    videoDuration   = TimeSecondToTimeStringConverter(Convert.ToDouble(Request.QueryString["duration"]));
                    videoFrameRate  = Convert.ToDouble(Request.QueryString["framerate"]);
                    startFrame      = Request.QueryString["startframe"];
                    videoTotalFrame = Request.QueryString["endframe"];
                    videoHeight     = Convert.ToInt32(Request.QueryString["videoresolution"]);
                    videoPlaySpeed  = playSpeedIncrement = Request.QueryString["playspeed"];
                    middleFrame     = videoTotalFrame;
                    CheckerAddress  = ConfigurationManager.AppSettings["hostAddress"] + "Checker.aspx?id=" + Request.QueryString["pid"];

                    if (Request.QueryString["timeposition"] != null)
                    {
                        audioStartDuration = TimeStringToSecondConverter(Request.QueryString["timeposition"]);
                        if (audioStartDuration >= Convert.ToDouble(Request.QueryString["duration"]))
                        {
                            audioStartDuration = 0;
                        }

                        startFrame = TimeToFrameConverter(audioStartDuration, videoFrameRate).ToString();
                    }
                    else
                    {
                        audioStartDuration = 0;
                    }
                    if (Request.QueryString["playspeed"] != null)
                    {
                        playSpeedIncrement = Request.QueryString["playspeed"];
                    }
                    else
                    {
                        playSpeedIncrement = "0";
                    }

                    #region Video player settings

                    #region Progress bar settings
                    if (Request.QueryString["progressbar"] != null)
                    {
                        if (Request.QueryString["progressbar"] == "true")
                        {
                            processProgressBar = "true";
                        }
                        else
                        {
                            processProgressBar = "false";
                        }
                    }
                    else
                    {
                        // Default
                        processProgressBar = "true";
                    }
                    #endregion Progress bar settings

                    #region Time settings
                    if (Request.QueryString["time"] != null)
                    {
                        if (Request.QueryString["time"] == "true")
                        {
                            processTime = "true";
                        }
                        else
                        {
                            processTime = "false";
                        }
                    }
                    else
                    {
                        // Default
                        processTime = "true";
                    }
                    #endregion Time settings

                    #endregion Video player settings
                }
                else
                {
                    videoFileName   = Request.QueryString["n"];
                    videoTotalFrame = Request.QueryString["tf"];
                    middleFrame     = Convert.ToInt32((Convert.ToDouble(videoTotalFrame) / 2)).ToString();
                    videoFrameRate  = Convert.ToDouble(Request.QueryString["fr"]);
                    if (Request.QueryString["sid"] != null)
                    {
                        sessionID = Request.QueryString["sid"];
                        testMode  = true;
                    }
                    if (testMode)
                    {
                        if (VideoSequenceLocation.EndsWith("/"))
                        {
                            VideoURL = VideoSequenceLocation + sessionID + "/" + videoFileName;
                        }
                        else
                        {
                            VideoURL = VideoSequenceLocation + "/" + sessionID + "/" + videoFileName;
                        }
                    }
                    else
                    {
                        if (VideoSequenceLocation.EndsWith("/"))
                        {
                            VideoURL = VideoSequenceLocation + Session.SessionID + "/" + videoFileName;
                        }
                        else
                        {
                            VideoURL = VideoSequenceLocation + "/" + Session.SessionID + "/" + videoFileName;
                        }
                    }
                }
            }
            else
            {
                displayPreloadImage = "false";
                VideoURL            = string.Empty;
                videoFileName       = string.Empty;
                videoDuration       = "0";
                videoFrameRate      = 0;
                startFrame          = string.Empty;
                videoTotalFrame     = string.Empty;
                videoHeight         = 0;
                videoPlaySpeed      = string.Empty;
                middleFrame         = string.Empty;
                CheckerAddress      = string.Empty;

                audioStartDuration = 0;
                startFrame         = string.Empty;
                playSpeedIncrement = string.Empty;
            }

            userRequestedURL = HelperClass.StringEncoderDecoder(Request.Url.AbsoluteUri, StringConversionMode.Encode) + "&encoded=true";
        }