{"id":7751,"date":"2020-04-29T18:30:00","date_gmt":"2020-04-29T13:00:00","guid":{"rendered":"https:\/\/www.argildx.us\/?p=7751"},"modified":"2021-06-15T12:12:17","modified_gmt":"2021-06-15T06:42:17","slug":"video-buffer-optimization-aem-seamless-video-playback-streaming","status":"publish","type":"post","link":"https:\/\/www.argildx.us\/technology\/video-buffer-optimization-aem-seamless-video-playback-streaming\/","title":{"rendered":"Video Buffer Optimization in AEM"},"content":{"rendered":"\n

Video is one of the most effective and easiest mediums of communicating information to your audience. If you’re looking to use this format of communication on your website, you would want it to work as seamlessly as possible. Video buffer optimization can help you considerably improve the video playback and streaming capabilities on your website. Before diving into video buffer optimization and its implementation in AEM, let\u2019s take a look at why it is required.<\/p>\n\n\n\n

In the early days of the internet, web browsers played videos via embedded video players like RealPlayer and Windows Media Player. This required custom codecs and browser plugins. The trend then moved on to Flash and Quicktime, which slowed down our browsers and sometimes caused security concerns.<\/p>\n\n\n\n

It took more than a decade to create <video> tag and achieve browser support for it. Today, most of the web is using <video> tag and as a result there are fewer browser crashes, less memory used, and smoother playback.<\/p>\n\n\n\n

Basic <video> Tag Usage<\/strong><\/h5>\n\n\n\n

Let’s look at an example of the use of <video> tag:<\/p>\n\n\n\n

<video width=\"640\" height=\"480\" poster=\"sample-video.jpg\" controls autoplay preload>\n <source src=\"sample-video.webm\" type=\"video\/webm\">\n <source src=\"sample-video.ogv\" type=\"video\/ogg\">\n <source src=\"sample-video.mp4\" type=\"video\/mp4\">\n<\/video><\/code><\/pre>\n\n\n\n
Online Video Buffer<\/strong><\/h5>\n\n\n\n

All these worked fine until we faced issues with <video> tag implementation. The function of this tag is to download all video data on page load by default. However, if the preload attribute is set to none, video will not be downloaded by the browser on page load but only when a user clicks or plays the video. So, we are just delaying the process and not allowing a seamless video playback and stream. Also, what if we want the video to be downloaded in packets or chunks and save bandwidth e.g. online video buffering.<\/p>\n\n\n\n

Why do we need video buffer optimization?<\/strong><\/h5>\n\n\n\n

The HTML5 <video> tag is not flexible enough if you need to add extra features and customizations on it. For such purposes you will need to use third-party APIs. Video.js is one such API that provides extra features and theme options on our traditional <video> tag.

If we increase a video size, then the time taken by the video to play or load will also increase. So, if we use a video of bigger size on a slow internet connection and we want to provide smoother experience to end user, we will have to optimize the video buffer process.

So, the workaround for this problem would be ‘play, pause and progress’. This means every time the progress event is triggered, we can check if the video is buffered by some percent (say 10%). It will continue buffering only \u201cwhat\u2019s needed\u201d when the video starts playing. That means the video will never be fully buffered.<\/p>\n\n\n\n

Steps for Implementing the Video Buffer Optimization<\/strong><\/h5>\n\n\n\n

Let’s take a look at how to implement video buffer optimization in AEM to allow a more seamless video playback and stream.<\/p>\n\n\n\n

Player.on(\"progress\", function () {\n   \/\/ Get Current Video seek time.\n    var currentTime = Player.currentTime();\n    \n    if (lastTime !== currentTime) {\n        lastTime = currentTime;\n    } else if (myPlayer.paused() === false) {\n         \/\/ (this.paused() will return true even if it's buffering, so we have to check the time advancement)\n        \/\/ Video is buffering\/waiting.\n        buffered = false;\n\n\n        bufferPause = true; \/\/ To indicate pause was initiated by this buffer check\n\n        lastBuffer = Player.bufferedPercent(); \/\/ To get the buffer percent of video.\n        \/\/ This buffer greater then 10% of the video. (0.1 = 10%)\n    } else if (!buffered && (Player.bufferedPercent() - lastBuffer > 0 || Player.bufferedPercent() > 0.1)) {\n        buffered = true;\n\n\n        \/\/ Resume playing if an additional 10% has been buffered.\n        if (bufferPause) {\n            Player.play();\n        }\n    }\n})\n<\/code><\/pre>\n\n\n\n

So, now you can get working on providing smooth video playback or streaming for your users on your AEM website. Feel free to write to us for any queries on this video buffer optimization or anything related to AEM.<\/p>\n\n\n\n

Contact us for AEM Integrations and Customizations<\/strong><\/h5>\n\n\n\n

While AEM comes packed with features and functionalities that make the life of developers and marketers easier, it can be enhanced to offer top-notch experiences to your users. Learn more about such AEM personalizations<\/a> that can enhance your users’ digital experience from certified Adobe Experience Cloud experts at Argil DX.<\/p>\n","protected":false},"excerpt":{"rendered":"

Video is one of the most effective and easiest mediums of communicating information to your audience. If you’re looking to use this format of communication on your website, you would want it to work as seamlessly as possible. Video buffer optimization can help you considerably improve the video playback and streaming capabilities on your website. … Read more<\/a><\/p>\n","protected":false},"author":29,"featured_media":7753,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","content-type":"","footnotes":""},"categories":[66],"tags":[25,2435,2436],"yst_prominent_words":[534,2226,2228,2233,2235,2170,2229,2234,2230,2239,2242,2245,2244,2246,1313,2227,2232,2240,2241,728],"acf":[],"yoast_head":"\nVideo Buffer Optimization in AEM | Seamless Video Playback and Stream<\/title>\n<meta name=\"description\" content=\"Video buffer optimization is a process of enabling a seamless video playback and stream in AEM websites by creating a safe buffer for every video progress.\" \/>\n<meta name=\"robots\" content=\"index, follow\" \/>\n<meta name=\"googlebot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta name=\"bingbot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.argildx.us\/technology\/video-buffer-optimization-aem-seamless-video-playback-streaming\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Video Buffer Optimization in AEM | Seamless Video Playback and Stream\" \/>\n<meta property=\"og:description\" content=\"Video buffer optimization is a process of enabling a seamless video playback and stream in AEM websites by creating a safe buffer for every video progress.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.argildx.us\/technology\/video-buffer-optimization-aem-seamless-video-playback-streaming\/\" \/>\n<meta property=\"og:site_name\" content=\"Argil DX\" \/>\n<meta property=\"article:published_time\" content=\"2020-04-29T13:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-06-15T06:42:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.argildx.us\/wp-content\/uploads\/2020\/04\/photo-of-boy-video-calling-with-a-woman-4145197-scaled.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1440\" \/>\n\t<meta property=\"og:image:height\" content=\"542\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.argildx.us\/#website\",\"url\":\"https:\/\/www.argildx.us\/\",\"name\":\"Argil DX\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.argildx.us\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.argildx.us\/technology\/video-buffer-optimization-aem-seamless-video-playback-streaming\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/www.argildx.us\/wp-content\/uploads\/2020\/04\/photo-of-boy-video-calling-with-a-woman-4145197-scaled.jpg\",\"width\":1440,\"height\":542,\"caption\":\"a boy watching a video of a woman speaking on an educational topic on screen\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.argildx.us\/technology\/video-buffer-optimization-aem-seamless-video-playback-streaming\/#webpage\",\"url\":\"https:\/\/www.argildx.us\/technology\/video-buffer-optimization-aem-seamless-video-playback-streaming\/\",\"name\":\"Video Buffer Optimization in AEM | Seamless Video Playback and Stream\",\"isPartOf\":{\"@id\":\"https:\/\/www.argildx.us\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.argildx.us\/technology\/video-buffer-optimization-aem-seamless-video-playback-streaming\/#primaryimage\"},\"datePublished\":\"2020-04-29T13:00:00+00:00\",\"dateModified\":\"2021-06-15T06:42:17+00:00\",\"author\":{\"@id\":\"https:\/\/www.argildx.us\/#\/schema\/person\/1c5b6f3f2f7218d9acb851588b98551f\"},\"description\":\"Video buffer optimization is a process of enabling a seamless video playback and stream in AEM websites by creating a safe buffer for every video progress.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.argildx.us\/technology\/video-buffer-optimization-aem-seamless-video-playback-streaming\/\"]}]},{\"@type\":[\"Person\"],\"@id\":\"https:\/\/www.argildx.us\/#\/schema\/person\/1c5b6f3f2f7218d9acb851588b98551f\",\"name\":\"Argil DX Media\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.argildx.us\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0ccbc04705942d1269cdf9f789e58484?s=96&d=mm&r=g\",\"caption\":\"Argil DX Media\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","_links":{"self":[{"href":"https:\/\/www.argildx.us\/wp-json\/wp\/v2\/posts\/7751"}],"collection":[{"href":"https:\/\/www.argildx.us\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.argildx.us\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.argildx.us\/wp-json\/wp\/v2\/users\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/www.argildx.us\/wp-json\/wp\/v2\/comments?post=7751"}],"version-history":[{"count":0,"href":"https:\/\/www.argildx.us\/wp-json\/wp\/v2\/posts\/7751\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.argildx.us\/wp-json\/wp\/v2\/media\/7753"}],"wp:attachment":[{"href":"https:\/\/www.argildx.us\/wp-json\/wp\/v2\/media?parent=7751"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.argildx.us\/wp-json\/wp\/v2\/categories?post=7751"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.argildx.us\/wp-json\/wp\/v2\/tags?post=7751"},{"taxonomy":"yst_prominent_words","embeddable":true,"href":"https:\/\/www.argildx.us\/wp-json\/wp\/v2\/yst_prominent_words?post=7751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}