Esempio n. 1
0
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            // Do nothing
        }
        else
        {
            string videoUrl = VideoURL.Trim();

            if (!ValidationHelper.IsURL(videoUrl))
            {
                EventLogProvider.LogEvent(EventType.ERROR, "YouTubeVideo", "INVALIDVIDEOURL", String.Format("YouTube video web part couldn't load the video because the given URL is not valid: {0}", HTMLHelper.HTMLEncode(videoUrl)));
                return;
            }

            // If no wmode is set, append 'transparent' wmode. Fix IE issue with widget (widgets buttons are beyond YouTube video)
            if (String.IsNullOrEmpty(URLHelper.GetQueryValue(videoUrl, "wmode")))
            {
                videoUrl = URLHelper.UpdateParameterInUrl(videoUrl, "wmode", "transparent");
            }

            YouTubeVideoParameters ytParams = new YouTubeVideoParameters
            {
                Url           = videoUrl,
                FullScreen    = FullScreen,
                AutoPlay      = AutoPlay,
                RelatedVideos = Rel,
                Width         = Width,
                Height        = Height,
            };

            ltlPlaceholder.Text = MediaHelper.GetYouTubeVideo(ytParams);
        }
    }
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected override void SetupControl()
    {
        if (StopProcessing)
        {
            // Do nothing
        }
        else
        {
            YouTubeVideoParameters ytParams = new YouTubeVideoParameters();
            ytParams.Url = VideoURL;

            // If no wmode is set, append 'transparent' wmode. Fix IE issue with widget (widgets buttons are beyond youtube video)
            if (String.IsNullOrEmpty(URLHelper.GetQueryValue(ytParams.Url, "wmode")))
            {
                ytParams.Url = URLHelper.UpdateParameterInUrl(ytParams.Url, "wmode", "transparent");
            }

            ytParams.FullScreen    = FullScreen;
            ytParams.AutoPlay      = AutoPlay;
            ytParams.Loop          = Loop;
            ytParams.RelatedVideos = Rel;
            ytParams.Width         = Width;
            ytParams.Height        = Height;

            ltlPlaceholder.Text = MediaHelper.GetYouTubeVideo(ytParams);
        }
    }
    protected void Page_PreRender(object sender, EventArgs e)
    {
        YouTubeVideoParameters ytParams = new YouTubeVideoParameters();

        ytParams.Url           = ResolveUrl(Url).Replace("\"", "\\\"");
        ytParams.FullScreen    = Fs;
        ytParams.AutoPlay      = AutoPlay;
        ytParams.Loop          = Loop;
        ytParams.RelatedVideos = Rel;
        ytParams.Width         = Width;
        ytParams.Height        = Height;

        ltlYouTube.Text = MediaHelper.GetYouTubeVideo(ytParams);
    }
    protected void Page_PreRender(object sender, EventArgs e)
    {
        // Render YouTube preview only if Url is set
        if (!string.IsNullOrEmpty(Url))
        {
            YouTubeVideoParameters ytParams = new YouTubeVideoParameters();
            ytParams.Url           = Url;
            ytParams.FullScreen    = Fs;
            ytParams.AutoPlay      = AutoPlay;
            ytParams.Loop          = Loop;
            ytParams.RelatedVideos = Rel;
            ytParams.Width         = Width;
            ytParams.Height        = Height;

            ltlYouTube.Text = MediaHelper.GetYouTubeVideo(ytParams);
        }
    }
Esempio n. 5
0
    /// <summary>
    /// Render control
    /// </summary>
    /// <param name="writer">Writer</param>
    protected override void Render(HtmlTextWriter writer)
    {
        // Render YouTube preview only if Url is set
        if (!string.IsNullOrEmpty(Url))
        {
            YouTubeVideoParameters ytParams = new YouTubeVideoParameters();
            ytParams.Url           = Url;
            ytParams.FullScreen    = Fs;
            ytParams.AutoPlay      = AutoPlay;
            ytParams.RelatedVideos = Rel;
            ytParams.Width         = Width;
            ytParams.Height        = Height;

            writer.Write(MediaHelper.GetYouTubeVideo(ytParams));
        }

        base.Render(writer);
    }
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            // Do nothing
        }
        else
        {
            YouTubeVideoParameters ytParams = new YouTubeVideoParameters();
            ytParams.Url           = ResolveUrl(VideoURL);
            ytParams.FullScreen    = FullScreen;
            ytParams.AutoPlay      = AutoPlay;
            ytParams.Loop          = Loop;
            ytParams.RelatedVideos = Rel;
            ytParams.Width         = Width;
            ytParams.Height        = Height;

            ltlPlaceholder.Text = MediaHelper.GetYouTubeVideo(ytParams);
        }
    }
Esempio n. 7
0
    protected void Page_PreRender(object sender, EventArgs e)
    {
        YouTubeVideoParameters ytParams = new YouTubeVideoParameters();

        ytParams.Url           = ResolveUrl(Url).Replace("\"", "\\\"");
        ytParams.FullScreen    = Fs;
        ytParams.PlayInHD      = PlayInHD;
        ytParams.AutoPlay      = AutoPlay;
        ytParams.Loop          = Loop;
        ytParams.RelatedVideos = Rel;
        ytParams.Delayed       = Cookies;
        ytParams.Border        = Border;
        ytParams.Color1        = Color1;
        ytParams.Color2        = Color2;
        ytParams.Width         = Width;
        ytParams.Height        = Height;

        ltlYouTube.Text = MediaHelper.GetYouTubeVideo(ytParams);

        string script = ScriptHelper.GetScript("window.onbeforeunload = function(){\n var ytEmbeds = document.getElementsByTagName('embed'); if (ytEmbeds.length > 0) {\n for (var i = 0; i < ytEmbeds.length; i++){\n ytEmbeds[i].parentNode.removeChild(ytEmbeds[i]);}}}");

        ScriptHelper.RegisterClientScriptBlock(Page, typeof(Page), "YouTubeUnload", script);
    }
    /// <summary>
    /// Render control
    /// </summary>
    /// <param name="writer">Writer</param>
    protected override void Render(HtmlTextWriter writer)
    {
        // Render YouTube preview only if Url is set
        if (!string.IsNullOrEmpty(Url))
        {
            YouTubeVideoParameters ytParams = new YouTubeVideoParameters();
            ytParams.Url = Url;
            ytParams.FullScreen = Fs;
            ytParams.AutoPlay = AutoPlay;
            ytParams.RelatedVideos = Rel;
            ytParams.Width = Width;
            ytParams.Height = Height;

            writer.Write(MediaHelper.GetYouTubeVideo(ytParams));
        }

        base.Render(writer);
    }
    protected void Page_PreRender(object sender, EventArgs e)
    {
        YouTubeVideoParameters ytParams = new YouTubeVideoParameters();
        ytParams.Url = ResolveUrl(Url).Replace("\"", "\\\"");
        ytParams.FullScreen = Fs;
        ytParams.AutoPlay = AutoPlay;
        ytParams.Loop = Loop;
        ytParams.RelatedVideos = Rel;
        ytParams.Width = Width;
        ytParams.Height = Height;

        ltlYouTube.Text = MediaHelper.GetYouTubeVideo(ytParams);
    }
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected override void SetupControl()
    {
        if (StopProcessing)
        {
            // Do nothing
        }
        else
        {
            YouTubeVideoParameters ytParams = new YouTubeVideoParameters();
            ytParams.Url = VideoURL;

            // If no wmode is set, append 'transparent' wmode. Fix IE issue with widget (widgets buttons are beyond youtube video)
            if (String.IsNullOrEmpty(URLHelper.GetQueryValue(ytParams.Url, "wmode")))
            {
                ytParams.Url = URLHelper.UpdateParameterInUrl(ytParams.Url, "wmode", "transparent");
            }

            ytParams.FullScreen = FullScreen;
            ytParams.AutoPlay = AutoPlay;
            ytParams.RelatedVideos = Rel;
            ytParams.Width = Width;
            ytParams.Height = Height;

            ltlPlaceholder.Text = MediaHelper.GetYouTubeVideo(ytParams);
        }
    }
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected override void SetupControl()
    {
        if (StopProcessing)
        {
            // Do nothing
        }
        else
        {
            YouTubeVideoParameters ytParams = new YouTubeVideoParameters();
            ytParams.Url = VideoURL;
            ytParams.FullScreen = FullScreen;
            ytParams.AutoPlay = AutoPlay;
            ytParams.Loop = Loop;
            ytParams.RelatedVideos = Rel;
            ytParams.Width = Width;
            ytParams.Height = Height;

            ltlPlaceholder.Text = MediaHelper.GetYouTubeVideo(ytParams);
        }
    }
Esempio n. 12
0
    protected void Page_PreRender(object sender, EventArgs e)
    {
        YouTubeVideoParameters ytParams = new YouTubeVideoParameters();
        ytParams.Url = ResolveUrl(Url).Replace("\"", "\\\"");
        ytParams.FullScreen = Fs;
        ytParams.PlayInHD = PlayInHD;
        ytParams.AutoPlay = AutoPlay;
        ytParams.Loop = Loop;
        ytParams.RelatedVideos = Rel;
        ytParams.Delayed = Cookies;
        ytParams.Border = Border;
        ytParams.Color1 = Color1;
        ytParams.Color2 = Color2;
        ytParams.Width = Width;
        ytParams.Height = Height;

        ltlYouTube.Text = MediaHelper.GetYouTubeVideo(ytParams);

        string script = ScriptHelper.GetScript("window.onbeforeunload = function(){\n var ytEmbeds = document.getElementsByTagName('embed'); if (ytEmbeds.length > 0) {\n for (var i = 0; i < ytEmbeds.length; i++){\n ytEmbeds[i].parentNode.removeChild(ytEmbeds[i]);}}}");
        ScriptHelper.RegisterClientScriptBlock(Page, typeof(Page), "YouTubeUnload", script);
    }