For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
StatusSupportDiscussionsLog inSign Up
Docs HomeAPI ReferenceVideo on DemandAI FeaturesLive StreamingVideo PlayerVideo DataCloud PlayoutRecipes
Docs HomeAPI ReferenceVideo on DemandAI FeaturesLive StreamingVideo PlayerVideo DataCloud PlayoutRecipes
  • Player SDKs
    • Introduction
  • Web player
    • Install the FastPix web player
    • Play uploaded videos
    • Handle playback errors
      • Use keyboard shortcuts
      • Customize thumbnails and posters
      • Configure preload and CORS settings
      • Set a custom domain
      • Secure video playback
      • Play DRM-protected content
      • Enable lazy loading
      • Monitor video data
      • Add shoppable video overlays
  • Android player
    • Install FastPix Android player
    • Set up the player
    • Play uploaded videos
    • Handle playback errors
  • iOS player
    • Install FastPix iOS player
    • Play uploaded videos
    • Handle playback errors
  • Flutter player
    • Install FastPix Flutter player
    • Play uploaded videos
    • Handle playback errors
LogoLogo
StatusSupportDiscussionsLog inSign Up
On this page
  • Preload the video
  • When to consider for preloading
  • Use crossorigin
  • Some considerations for using crossorigin
  • Combine preload and crossorigin
Web playerAdvanced features

Configure preload and CORS settings

Was this page helpful?
Previous

Set a custom domain

Next
Built with

Control video load behavior and CORS policy with preload and crossorigin for secure playback.

When embedding video content in your web application, it’s crucial to understand and effectively use the preload and crossorigin attributes to enhance the performance, security, and overall user experience of your media content. Below, you will find a explanation of these attributes, including their possible values, usage scenarios, and practical examples.


Preload the video

The preload attribute hints to the browser how much of the video should be loaded before playback begins. This can greatly influence the performance and user experience, especially on networks with varying speeds. Possible values: none, metadata, auto

none: Indicates that the video should not be preloaded. This is useful if you want to save bandwidth for users who may not watch the video.


1<fastpix-player
2 playback-id="{Playback_id}"
3 preload="none"
4></fastpix-player>

metadata: Only the metadata (such as length, dimensions, and first frame) of the video is fetched. This is a good compromise between saving bandwidth and providing some information about the video.

1<fastpix-player
2 playback-id="{Playback_id}"
3 preload="metadata"
4></fastpix-player>

auto: The entire video can be downloaded, even if the user might not watch it. This ensures that the video is ready for playback without delay.

1<fastpix-player
2 playback-id="{Playback_id}"
3 preload="auto"
4></fastpix-player>

When to consider for preloading

  • Preloading large video files on slow connections can increase page load times for other resources.
  • If users are unlikely to view the video, preloading might waste bandwidth.

Use crossorigin

The crossorigin attribute is used to handle the CORS (Cross-Origin Resource Sharing) settings for your video. This attribute ensures that the browser requests the video in a manner that adheres to the specified CORS policy, which is essential for accessing media files from different origins.

Possible values: anonymous, use-credentials.


anonymous: Sends a CORS request without credentials (e.g., cookies, X.509 certificates, etc.). This is the default value if the attribute is not set. It allows for cross-origin sharing of the resource without exposing user-specific data.

1<fastpix-player
2 playback-id="{Playback_id}"
3 crossorigin="anonymous"
4></fastpix-player>

use-credentials: Sends a CORS request with credentials, allowing access to resources that require authentication or user-specific data.

1<fastpix-player
2 playback-id="{Playback_id}"
3 crossorigin="use-credentials"
4></fastpix-player>

Some considerations for using crossorigin

  • Use anonymous unless the video requires credentials for access.
  • Ensure the server hosting the video is set up to handle CORS requests correctly.

Combine preload and crossorigin

Using these attributes together, you can optimize both the loading performance and security of your video content.

For instance:

1<fastpix-player
2 playback-id="{Playback_id}"
3 preload="metadata"
4 crossorigin="use-credentials"
5></fastpix-player>

In this example, the browser will preload only the video metadata and include credentials in the cross-origin request, which is suitable for protected video content that requires authentication.