How to stop preloading content on the RadMediaPlayer?

1 Answer 5 Views
MediaPlayer
Richard
Top achievements
Rank 1
Richard asked on 12 Nov 2021, 03:34 AM

We use the Radmediaplayer. However on page load, it loads the first chunk of the media file. When looking at the network logs we confirmed it loads on page load. Note this  is not auto play, the file does not start until we press play. 

What this means is that our stats are reporting very high file consumption and reporting downloads is not correct. We would like to stop the preload. Our current code is:

<telerik:RadMediaPlayer ID="RadMediaEpisodePlayer" Height="300" Width="100%"

                                        EnableViewState="false" runat="server" AutoPlay="false"
                                        HDActive="false" 
                                        RenderMode="Auto">
                                    </telerik:RadMediaPlayer>

Thank you all for help in advance

1 Answer, 1 is accepted

Sort by
0
Doncho
Telerik team
answered on 16 Nov 2021, 01:04 PM

Hi Richard,

The RadMediaPlayer is rendering an HTML5 video element which by default supports a preload attribute, see video preload.

Currently, the RadMediaPlayer is not exposing a property to control the preload attribute but you can get a reference to the video tag and set ''none" value to the attribute with the loading of the page, e.g in $( document ).ready():

<telerik:RadMediaPlayer ID="RadMediaEpisodePlayer" Height="300" Width="100%"
    EnableViewState="false" runat="server" AutoPlay="false"
    HDActive="false"
    RenderMode="Auto">
</telerik:RadMediaPlayer>
<script>
    $telerik.$(document).ready(function () {
        var mediaPlayer = $find("<%= RadMediaEpisodePlayer.ClientID %>");
        var mediaPlayerVideoElement = $telerik.$(mediaPlayer.get_element()).find('video')[0];
        mediaPlayerVideoElement.setAttribute('preload', 'none');
    })
</script>
Please give it a try and let me know how it goes for you.

Kind regards,
Doncho
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
MediaPlayer
Asked by
Richard
Top achievements
Rank 1
Answers by
Doncho
Telerik team
Share this question
or