What Happens When You Click ‘Play’
Last updated: 4 April 2023
Online video. Everyone loves it. Remember how you had to download, and sometimes wait for hours before you could watch a video? Today you just click ‘play’ video and watch thanks to advanced streaming technologies. It sounds so easy. But did you know there is an entire world of technologies behind that single click-to-play?
The video player
Websites, browsers and apps are often unable to display video or audio properly on their own. To display radio, podcasts, videos and livestreams, a video player must first be loaded. Modern video players are based on javascript, which we call HTML5 players. Creating such a player is a speciality.
Connections
Loading players and videos always starts with a DNS request, then follows the exchange of secure keys, and then follows the actual request and server response. Often there is not 1 DNS server, but a worldwide network of DNS servers is used, which is faster, more scalable and more reliable. Next, contact is made with the server. Also, this is often a global network of many servers, this is called a CDN (Content Delivery Network). Each step below involves the process described here.
Modules
Modern video players are modular, so they load only the code that is needed. There are dozens of modules for subtitles, ads, Chromecast and thumbnails, for example. Depending on the desired functions, these modules are loaded, usually from the same player servers.
The design
Loading a video is one thing. Showing something beautiful is two. Video players can give you a unified brand experience, with equivalent functions on every possible device. The video player loads certain configurations, such as colours, buttons, subtitles, thumbs, the image you see, and the play button. It also loads the link to the video. A lot has already happened before you can click ‘play’.
MultiCDN
Video is heavy so a single server doesn’t scale. CDNs are global scalable infrastructures. Using multiple CDNs is gaining popularity. This increases performance, scale and availability. Multi-CDN is complex and is a speciality in itself. The video link is not always directly to a server or a CDN, but to an intermediate layer: The multi-CDN load balancer. At Jet-Stream, this is an active load balancer, with an algorithm that analyzes the request in real-time, chooses the best route based on proximity, availability, price and specific rules, and redirects the player ultra-fast to the chosen CDN. Monitors are used to collecting this data. The advantage of Jet-Stream’s active solution is that the most optimal route can be enforced for each individual request. This increases costs and availability control.
Security
With Jet-Stream, the load balancing process also immediately checks the validity of the request. Are you requesting a video that does not exist? Does the account name exist, is it locked, or deleted? Are you perhaps in a region of the world where the owner does not allow you to see this video? Is this video locked, added the website a valid key so you can watch? So there may be an intermediate step that the portal, site or app checks that you have sufficient permissions to watch. Jet-Stream then checks and monitors access, along with the CDNs.
CDN
After being referred via multi-CDN, the player requests the video link from the CDN, including a new access key, so that the CDN can also validate the request. The CDN has internal logic to send the requester to an edge server or pool of servers nearby. Upon contacting this server, the player requests the video link. When Jet-Stream’s own CDN is chosen, streams load up to 430% faster, thanks to optimizations. This not only enables 8K streaming but also ensures that streams are played at higher quality (see adaptive streaming, below). Other CDNs have other advantages such as capacity in regions such as South America, Africa, the Middle East, Asia and China, for example.
Caching
If you are the first in a while to request a video on an “edge server” that is not yet, or no longer, present in this local server. This server then makes real-time contact with its source server. Often that is another cache. There can be multiple caches in a chain, such as “origin shields,” until they request the video from the source: the origin server. Often CDNs optimize specific caching settings. This is because different caching requirements apply to livestreams and videos.
Origin
The origin server is the server where the video resides. It reads the requested media from disk (or from memory), and forwards it ultra-fast. The chain of caches forwards the video to the next cache until it finally arrives at the player. The entire process above happens in a fraction of a second. The caches hold the requested files locally for a while so that new viewers can be served faster. They then don’t have to go back to their source for each request. That scales tremendously well. Jet-Stream provides redundant origins with automatic failover, so you can use 2 encoders and 2 uplinks, which further increases the resilience of your live streams, even when one of these paths fails.
Thundering herd
When a lot of people are watching a stream live, caches may redirect all requests to the origin. Smart caches remember that they have multiple requests for the same file, and group the request to the origin. This prevents it from being overloaded. When adaptive streaming emerged, Jet-Stream developed this technique with the developers of one of the most widely used caching software, and of course, applies it in its own caches.
Adaptive streaming
Increasingly, videos are no longer downloadable files, but so-called adaptive streams. The video then exists in multiple qualities. So that the player can choose the most suitable quality that suits your device, screen size and connection. You just click ‘play’ and the player then adapts the stream to the circumstances. This provides a buffer-free, high-quality experience, we call this QoE. Popular technologies are Apple’s HLS and MPEG DASH.
Transcoding
There must then be multiple qualities of video. The process of creating these qualities is called transcoding. This is an intensive process; it uses a lot of processing power and a lot of electricity. Many times this process is done in the cloud, like Jet-Stream. Transcoding is a business in itself because it involves a complex mix of conflicting interests such as image quality, latency, cost and scale and requires a deep understanding of codecs. With Jet-Stream, you have the freedom to provide these qualities yourself up to and including 8K, and with Jet-Stream you can set what qualities you want on a per-video basis, up to and including 4K.
Manifest and chunks
The video is cut up into very short pieces so that the player can always switch between the optimal quality. This process is called transmuxing. All the chunks are described in a manifest. This is a playlist that tells not only which video fragments there are, but also in which qualities. Sometimes those fragments are already prepared. And sometimes the server creates those chunks in real-time. Jet-Stream supports both options.
Algorithm
When you click play, the player first retrieves and reads the manifest. Then the player begins to retrieve the first video chunks. These two go piece by piece through the whole connection and caching process as described above. A built-in algorithm measures how fast the fragments are coming in. This allows the player to choose which quality to play so it can show the highest quality while preventing rebuffering. This algorithm does this permanently. The player glues the fragments together so that you experience a smooth stream, that can go up and down in quality.
Mid-stream switching
The Jet-Stream player has extra intelligence on board to go back to the multi-CDN load balancer when data is not coming in fast enough so that mid-stream switching to another CDN is possible. This further increases stream availability and performance.
One-click, many processes
In short, 1 click on “play” , and a huge vat of technology is opened up to ensure you have an instant, buffering-free great video experience.
That’s not all.
DRM: Sometimes DRM is used to provide additional security for videos. Videos and streams are encrypted. And runs behind the scenes another process with servers with which the player exchanges keys so that it can be determined who is allowed to watch. At Jet-Stream, the use of DRM is optional. DRM is also a speciality in itself.
Tracking: When you click play, players often log data, such as stream performance, or viewing behaviour. This data is transmitted in real-time to third-party cloud services, where the data is analyzed. To protect your privacy, Jet-Stream deliberately does not do tracking and data sharing.
Personalization: it is increasingly common for videos to be personalized. Think custom-tailored ads or a playlist that specifically suits your tastes. Again, this is a world unto itself. Take advertising. The use of cookies in advertising is rightly increasingly blocked, for privacy reasons. Jet-Stream offers content owners and advertisers the ability to work based on context. We then collect non-privacy-sensitive data such as title, description, keywords, browser, city, etc. Based on this data, advertisers can show you ads that still suit you without invading your privacy.
Logging: all servers permanently log all actions. It is counted how many times the player is loaded, how many videos, chunks, and manifests have been retrieved, and how much data traffic has been used. All these billions of log lines are centrally processed into reports in real-time. Log processing has to be as efficient as possible because of the enormous scale. Log processing and analytics takes more cloud resources than streaming itself.
Privacy: Jet-Stream uses this reliable and comprehensive data for invoicing and viewing behaviour reporting. Your privacy is guaranteed in the process: all data is protected in our European secure cloud, and not shared with anyone else. IP addresses are not shown.
Get to know Jet-Stream
Are you curious about our service and want to give it a try? You can do so thanks to our test environment. Experience all of the benefits our service has to offer!