Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["i"]))
            {
                // Sanitize the video ID
                string requestedID = Sanitizers.SanitizeQueryStringID(Request.QueryString["i"]);

                VideoRepository videoRepository = new VideoRepository();
                Video           video           = videoRepository.Get(requestedID);

                if (video != null)
                {
                    // Determine if the viewer is viewing from inside the network
                    string clientIP = Request.ServerVariables["REMOTE_ADDR"];
                    bool   canUserAccessPrivateContent = Config.CanAccessPrivate(clientIP);

                    if (
                        (video.IsPrivate && canUserAccessPrivateContent) ||
                        (!video.IsPrivate)
                        )
                    {
                        // Set the page title
                        string originalTitle = Page.Header.Title;
                        Page.Header.Title = video.Name + " - " + originalTitle;

                        // Determine which player to display the video in
                        if (video.IsYoutubeAvailable)
                        {
                            litPlayer.Text = YoutubeVideoPlayer.GetHTML(video);
                        }
                        else
                        {
                            litPlayer.Text = HTML5VideoPlayer.GetHTML(video);
                        }
                        tblContainer.Visible = true;

                        litVideoInfo.Text = videoInfoSection(video);
                    }
                    else
                    {
                        displayError("This video is marked as private. you can only watch from within the LSKYSD network.");
                    }
                }
                else
                {
                    displayError("A video with that ID was not found.");
                }
            }
        }
 private void LoadVideo()
 {
     YoutubeVideoPlayer.LoadVideo(videoPlayer, urls[currentVideo]);
 }