From a407f40cfcfa5929f408071f5ae16b9946f3e506 Mon Sep 17 00:00:00 2001 From: KB Bot Date: Wed, 9 Oct 2024 07:45:22 +0000 Subject: [PATCH 1/2] Added new kb article mediaplayer-auto-hide-player-wehn-video-ends --- ...player-auto-hide-player-wehn-video-ends.md | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 knowledge-base/mediaplayer-auto-hide-player-wehn-video-ends.md diff --git a/knowledge-base/mediaplayer-auto-hide-player-wehn-video-ends.md b/knowledge-base/mediaplayer-auto-hide-player-wehn-video-ends.md new file mode 100644 index 0000000000..b5e2b3173e --- /dev/null +++ b/knowledge-base/mediaplayer-auto-hide-player-wehn-video-ends.md @@ -0,0 +1,62 @@ +--- +title: Auto Hide Video Player After Video Ends +description: Learn how to automatically play a video on page load and hide the RadMediaPlayer control once the video ends in ASP.NET AJAX applications. +type: how-to +page_title: Auto Hide Video Player After Video Ends +slug: mediaplayer-auto-hide-player-wehn-video-ends +tags: radmediaplayer, asp.net ajax, video, autoplay, hide, client-side events +res_type: kb +ticketid: 1666814 +--- + +## Environment + + + + + + + + + + + + +
ProductRadMediaPlayer for ASP.NET AJAX
VersionAll
+ +## Description + +I want to auto-play an MP4 video with sound on page load and make the video player disappear after the video has finished playing. The goal is to play a short welcome video by the owner that automatically hides itself upon completion. + +This KB article also answers the following questions: + +- How can I make RadMediaPlayer auto-play a video? +- Is it possible to hide RadMediaPlayer after the video ends? +- Can RadMediaPlayer start playing a video automatically and then hide itself? + +## Solution + +To achieve the desired behavior of auto-playing a video and hiding the [RadMediaPlayer](https://docs.telerik.com/devtools/aspnet-ajax/controls/mediaplayer/overview) after it ends, use the `OnClientEnded` [client-side event](https://docs.telerik.com/devtools/aspnet-ajax/controls/mediaplayer/client-side-programming/overview#client-side-events). In the event handler, you can set the visibility of the RadMediaPlayer to `false`. + +1. Add the RadMediaPlayer control to your ASP.NET AJAX page. + +````ASP.NET + +```` + +2. Define the `onClientEnded` JavaScript function. This function will be triggered when the video playback ends, hiding the RadMediaPlayer control. + +````JavaScript +function onClientEnded(sender, args) { + sender.set_visible(false); +} +```` + +By following these steps, the RadMediaPlayer will automatically begin playing the video when the page loads and will hide itself after the video concludes, achieving the effect of a welcoming video that disappears post-playback. + +## See Also + +- [RadMediaPlayer Overview](https://docs.telerik.com/devtools/aspnet-ajax/controls/mediaplayer/overview) +- [MediaPlayer Client-Side Programming](https://docs.telerik.com/devtools/aspnet-ajax/controls/mediaplayer/client-side-programming/overview) +- [MediaPlayer Client-Side Events](https://docs.telerik.com/devtools/aspnet-ajax/controls/mediaplayer/client-side-programming/overview#client-side-events) From 142969e8d674e8fd609a5e624811773b2a21b43d Mon Sep 17 00:00:00 2001 From: P1l3T0 Date: Wed, 9 Oct 2024 11:02:26 +0300 Subject: [PATCH 2/2] kb(mediaplayer): update article --- ...s.md => mediaplayer-auto-hide-player-when-video-ends.md} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename knowledge-base/{mediaplayer-auto-hide-player-wehn-video-ends.md => mediaplayer-auto-hide-player-when-video-ends.md} (90%) diff --git a/knowledge-base/mediaplayer-auto-hide-player-wehn-video-ends.md b/knowledge-base/mediaplayer-auto-hide-player-when-video-ends.md similarity index 90% rename from knowledge-base/mediaplayer-auto-hide-player-wehn-video-ends.md rename to knowledge-base/mediaplayer-auto-hide-player-when-video-ends.md index b5e2b3173e..a212ffd75d 100644 --- a/knowledge-base/mediaplayer-auto-hide-player-wehn-video-ends.md +++ b/knowledge-base/mediaplayer-auto-hide-player-when-video-ends.md @@ -3,7 +3,7 @@ title: Auto Hide Video Player After Video Ends description: Learn how to automatically play a video on page load and hide the RadMediaPlayer control once the video ends in ASP.NET AJAX applications. type: how-to page_title: Auto Hide Video Player After Video Ends -slug: mediaplayer-auto-hide-player-wehn-video-ends +slug: mediaplayer-auto-hide-player-when-video-ends tags: radmediaplayer, asp.net ajax, video, autoplay, hide, client-side events res_type: kb ticketid: 1666814 @@ -38,14 +38,14 @@ This KB article also answers the following questions: To achieve the desired behavior of auto-playing a video and hiding the [RadMediaPlayer](https://docs.telerik.com/devtools/aspnet-ajax/controls/mediaplayer/overview) after it ends, use the `OnClientEnded` [client-side event](https://docs.telerik.com/devtools/aspnet-ajax/controls/mediaplayer/client-side-programming/overview#client-side-events). In the event handler, you can set the visibility of the RadMediaPlayer to `false`. -1. Add the RadMediaPlayer control to your ASP.NET AJAX page. +Add the RadMediaPlayer control to your ASP.NET AJAX page. ````ASP.NET ```` -2. Define the `onClientEnded` JavaScript function. This function will be triggered when the video playback ends, hiding the RadMediaPlayer control. +Define the `onClientEnded` JavaScript function. This function will be triggered when the video playback ends, hiding the RadMediaPlayer control. ````JavaScript function onClientEnded(sender, args) {