
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
@fastpix/fastpix-player
Advanced tools
FastPix Player SDK is a customizable video player for on-demand and live streaming.
This SDK simplifies HLS video playback by offering a wide range of customization options for an enhanced viewing experience. It streamlines streaming setup by utilizing playback IDs that have reached the "ready" status to generate stream URLs. These playback IDs enable seamless integration and video playback within the FastPix-player, making the entire streaming process efficient and user-friendly.
The playback-id
allows for easy video playback by linking directly to the media file. Playback is available as soon as the media status is "ready."
auto-play
: Automatically starts playback once the video is loaded, providing a seamless user experience.
loop
: Allows the video to repeat automatically after it finishes, perfect for continuous viewing scenarios.
Note : Some browsers restrict auto-play
functionality, especially for videos with audio. To comply with these restrictions, auto-play
often requires explicit user interaction or permission to be enabled. Ensure users are aware and can manually activate auto-play
if needed.
the token
attribute is required to play private or DRM protected streams
Note: The token can be empty for public streams
metadata
, ensure that video data is loaded in advance, reducing buffer times.thumbnail-time
attribute, set a custom poster
image to show before the video begins playing, or use a placeholder
to display a temporary image or background while the video is loading.The player automatically detects subtitles from the manifest file and displays them during playback. This ensures that users can easily access available subtitle tracks without additional configuration.
Users can switch between available subtitles and audio tracks during playback, offering a personalized viewing experience. This feature allows viewers to choose their preferred language or audio option easily.
Customize the player’s visual elements using the accent-color
, primary-color
, and secondary-color
attributes:
accent-color
: Represents the branding color, ensuring the player aligns with your brand identity.
primary-color
: Applies color to the icons, enhancing their visibility and style.
secondary-color
: Sets the background color of the icons, providing a complementary look and feel.
These attributes enable the creation of brand-aligned themes for a cohesive user experience.
The player supports on-demand
and live-stream
capabilities by utilizing specified stream-type
, enabling a versatile playback experience based on content type.
Define the stream-type
and default-stream-type
to set default stream behaviors, adapting to whether the content is live or on-demand.
Customize playback with default-playback-rate
and multiple playback-rates
options for various speeds.
Manage video quality with min-resolution
, max-resolution
, and resolution
options, allowing either automated or controlled playback quality adjustments.
aspect-ratio
property to the FastPix Player element, specifying the desired aspect ratio based on the preference.Flexibly hide or show specific player controls or all controls as needed, allowing for a customized viewing interface.
Player controls fade away after a few seconds of inactivity, minimizing distractions. They can reappear with user interaction, ensuring a smooth and immersive viewing experience.
K
or Spacebar
to toggle play and pause.M
to toggle mute.F
to enter or exit fullscreen mode.C
to toggle captions on and off.cross-origin
attribute enables proper handling of cross-origin requests, allowing resources to be fetched securely across different origins and enhancing security when accessing media files.enable-lazy-loading
option optimizes resource usage by loading video data only when necessary.title
attribute allows you to set a title for the video, enhancing context and providing additional information to viewers.To get started with the FastPix Player SDK we need some prerequisites, follow these steps:
Explore our detailed guide to upload videos and getting a playback ID using FastPix APIs
To get started with the SDK, first install the FastPix Player SDK for Web, you can use npm or your favourite node package manager 😉:
npm install @fastpix/fastpix-player
<fastpix-player playback-id="playback-id" stream-type="on-demand"/>
Click here for a detailed overview.
The playback-id
allows for easy video playback by linking directly to the media file. Playback is available as soon as the media status is "ready".
<fastpix-player playback-id="playback-id" />
Here, the stream-type
is set to on-demand
by default.
<fastpix-player playback-id="playback-id" stream-type="live-stream" />
Here, the stream-type
is set to live-stream
to play live streams.
Secure your video playback with a signed playback using a playback-id
and token
.
<fastpix-player
playback-id="your-playback-id"
stream-type="on-demand"
token="your-secure-token"
></fastpix-player>
<fastpix-player
playback-id="your-live-playback-id"
stream-type="live-stream"
token="your-secure-token">
</fastpix-player>
The token ensures authorized access, securing both on-demand and live-stream content.
Data integration involves combining data from different sources to provide a unified view.
In this implementation, various video and user-related attributes are extracted and mapped for analytics tracking. These attributes help monitor and analyze video playback behavior, user interaction, and other metrics.
Important Note:
To enable data integration, ensure the metadata-workspace-key
attribute is present.
Disable data monitoring:
To disable data tracking after providing all required attributes, use the disable-data-monitoring
attribute.
<fastpix-player
playback-id="your-live-playback-id"
stream-type="live-stream"
metadata-workspace-key="metadata workspace key"
metadata-video-title="video title"
metadata-viewer-user-id="user id"
metadata-video-id="video-id"
disable-data-monitoring
>
</fastpix-player>
To facilitate debugging of the data monitoring setup, use the enable-debug
attribute.
<fastpix-player
playback-id="your-live-playback-id"
stream-type="live-stream"
metadata-video-title="video title"
metadata-viewer-user-id="user id"
metadata-video-id="video-id"
enable-debug
>
</fastpix-player>
To honor users' privacy preferences regarding the 'Do Not Track' setting, set the respect-do-not-track
attribute to true
.
<fastpix-player
playback-id="your-live-playback-id"
stream-type="live-stream"
metadata-video-title="video title"
metadata-viewer-user-id="user id"
metadata-video-id="video-id"
respect-do-not-track
>
</fastpix-player>
Disabling Cookies During Data Monitoring:
If you prefer to monitor data without utilizing cookies, include the disable-cookies
attribute.
<fastpix-player
playback-id="your-live-playback-id"
stream-type="live-stream"
metadata-workspace-key="metadata workspace key"
metadata-video-title="video title"
metadata-viewer-user-id="user id"
metadata-video-id="video-id"
disable-cookies
>
</fastpix-player>
Context Attribute | Extracted Data Attribute | Description |
---|---|---|
metadata-workspace-key | workspace_id | Unique identifier for the workspace. |
metadata-video-title | video_title | Title of the video being played. |
metadata-viewer-user-id | viewer_id | Identifier for the viewer watching the video. |
metadata-video-id | video_id | Unique ID of the video. |
metadata-experiment-name | experiment_name | Name of any ongoing experiment related to the video. |
metadata-player-name | player_name | Name of the video player being used. |
metadata-player-version | player_version | Version of the video player. |
metadata-video-duration | video_duration | Duration of the video in seconds. |
metadata-view-session-id | view_session_id | Session ID for the video viewing. |
metadata-page-context | page_context | Context of the page where the video is embedded. |
metadata-sub-property-id | sub_property_id | ID for any specific sub-property of the video. |
metadata-video-content-type | video_content_type | Type of video content (e.g., live or on-demand). |
metadata-video-drm-type | video_drm_type | Type of DRM (Digital Rights Management) used for the video. |
metadata-video-encoding-variant | video_encoding_variant | Encoding variant of the video, like resolution or bitrate. |
metadata-video-language-code | video_language_code | Language code of the video's audio (e.g., "en" for English). |
metadata-video-producer | video_producer | Producer or creator of the video content. |
metadata-video-variant-name | video_variant_name | Name of the specific video variant (e.g., resolution). |
metadata-video-cdn | video_cdn | CDN used to deliver the video content. |
metadata-video-variant-id | video_variant_id | Unique ID for the video variant. |
metadata-video-series | video_series | Series name or ID if the video is part of a series. |
metadata-custom-1 to metadata-custom-10 | custom_1 to custom_10 | Custom metadata attributes for additional information. |
workspace_id
, video_id
, video_title
) help in identifying the video and its associated workspace for tracking purposes.viewer_id
, view_session_id
attributes track the user and session specifics for personalized analytics.player_name
, player_version
, video_duration
, and video_language_code
provide detailed information about the video playback and the player environment.browser_name
and os_name
offer insights into the viewer's device environment.For more detailed information, please refer to the FastPix User Passable Metadata Documentation.
Explore detailed guides for all features.
To utilize the experimental cache-busting feature, include the enable-cache-busting
attribute in your player. This ensures that when tracks are added dynamically, the player checks for an updated manifest.
<fastpix-player
playback-id="your-playback-id"
stream-type="on-demand"
enable-cache-busting
></fastpix-player>
Note: This feature is currently in beta and may be deprecated in future releases.
For comprehensive documentation and advanced usage, visit the FastPix Player Documentation[https://docs.fastpix.io/docs/overview-and-features].
Enhance your web applications with FastPix Player's seamless streaming and extensive customization options.
The auto-play
attribute enables the video to start playing automatically when the player is initialized. This feature requires user interaction or appropriate permissions depending on browser policies.
<fastpix-player
playback-id="your-playback-id"
stream-type="live-stream"
auto-play
>
</fastpix-player>
The crossorigin attribute in specifies the crossorigin
request policy (anonymous
, use-credential
s, or empty
), where an empty value implies no crossoorigin requests unless explicitly supported by the resource.
<!-- Example of <fastpix-player> with crossorigin attribute -->
<!-- 1. Anonymous: Allows cross-origin requests without credentials -->
<fastpix-player playback-id="playback-id" crossorigin="anonymous" />
<!-- 2. Use-credentials: Allows cross-origin requests with credentials -->
<fastpix-player playback-id="playback-id" crossorigin="use-credentials" />
<!-- 3. Default (empty or omitted): No cross-origin requests unless explicitly allowed -->
<fastpix-player playback-id="playback-id"></fastpix-player>
The default-playback-rate
attribute sets the default playback speed of the video.
<fastpix-player
playback-id="your-playback-id"
stream-type="live-stream"
default-playback-rate=3
>
</fastpix-player>
The default-show-remaining
attribute in is used to display the remaining time of the video in the format -00:30 / 00:30. When enabled, it shows the time left (negative value) alongside the total duration of the video, giving users a clear indication of how much time remains during playback.
<fastpix-player
playback-id="your-playback-id"
stream-type="live-stream"
default-show-remaining-time />
The default-stream-type
attribute in is used to specify the default stream type for playback, such as live or on-demand. This attribute allows the player to load and handle the appropriate stream type based on the video content, ensuring proper playback behavior for either live streaming or on-demand video playback.
<fastpix-player playback-id="your-playback-id" default-stream-type="live-stream" />
The disable-hidden-captions
attribute in is used to prevent any hidden captions from being displayed by default. When this attribute is enabled, captions or subtitles that are hidden within the video will not be shown unless explicitly enabled by the user.
<fastpix-player playback-id="your-playback-id" disable-hidden-captions />
The enable-lazy-loading
attribute enables the lazy loading feature for the , which loads the video content only when it becomes visible in the viewport, improving initial page load performance.
<div style="margin-top: 100px;">
<fastpix-player playback-id="your-playback-id" enable-lazy-loading></fastpix-player>
</div>
The loop
attribute allows the video to restart automatically from the beginning once it ends, creating a seamless playback experience.
<fastpix-player
playback-id="your-playback-id"
stream-type="live-stream"
loop
>
</fastpix-player>
The muted
attribute sets the initial volume of the video to 0, ensuring playback starts without sound. This is particularly useful for auto-play
functionality, as many browsers require videos to be muted to play automatically.
<fastpix-player
playback-id="your-playback-id"
stream-type="live-stream"
muted
>
</fastpix-player>
The no-volume-pref
attribute disables saving volume preferences in local storage, ensuring volume resets to default on each session.
<fastpix-player
playback-id="your-playback-id"
stream-type="live-stream"
no-volume-pref
>
</fastpix-player>
The playback-rates
attribute defines a list of available playback speed options for the user to select.
<fastpix-player
playback-id="your-playback-id"
stream-type="live-stream"
playback-rates="3 5 2 1"
>
</fastpix-player>
The preload attribute in the element specifies how the player should preload the media content. It can take the following values:
auto
: The player will preload the entire media file to ensure immediate playback without buffering.
metadata
: Only the metadata (e.g., duration, dimensions) of the media file will be preloaded, without fetching the entire content.
none
: The player will not preload the media and will only load the content when playback is initiated by the user.
<fastpix-player preload="auto" playback-id="your-playback-id" ></fastpix-player>
The start-time
attribute allows specifying the initial playback position in seconds when the video starts.
<fastpix-player
playback-id="your-playback-id"
stream-type="live-stream"
start-time=5
>
</fastpix-player>
The title
attribute in displays the provided text at the top left corner of the player, offering a brief description or title of the video content. This can be useful for displaying the video's name or additional context directly on the player interface.
<fastpix-player
playback-id="your-playback-id"
stream-type="live-stream"
title="Your video title"
>
</fastpix-player>
The target-live-window
attribute works only when the stream-type is set to live-stream, controlling the duration of the visible segment and displaying only the most recent content.
<fastpix-player
playback-id="your-playback-id"
stream-type="live-stream"
title="Your video title"
target-live-window
>
</fastpix-player>
Here are the resolution settings for the min-resolution, max-resolution, resolution, and rendition-order attributes:
min-resolution
: Specifies the minimum resolution for video playback, preventing lower-quality video selections.<fastpix-player playback-id="playback-id" min-resolution="1440p" />
max-resolution
: Sets the maximum resolution for video playback, restricting higher-quality video selections.<fastpix-player playback-id="playback-id" max-resolution="1440p" />
resolution
: Defines the preferred resolution for video playback, with potential adjustments based on conditions.<fastpix-player playback-id="playback-id" resolution="1440p" />
rendition-order
: Specifies the priority order for video resolutions in adaptive streaming, which can be set to either asc
(ascending) or desc
(descending), with the default being asc
.
<fastpix-player
playback-id="playback-id"
resolution="1440p"
rendition-order="desc"
/>
Image customization allows you to adjust the appearance of media elements such as thumbnails, posters, and spritesheets in the player.
The poster
attribute specifies an image to display as a preview before the video starts playing.
poster
attribute in the element whenever needed by setting a new image URL. For example:<fastpix-player playback-id="playback-id" poster="https://example.com/new-poster-image.jpg" />
<fastpix-player playback-id="playback-id" poster=""></fastpix-player>
The placeholder
attribute in is used to specify a fallback image that is displayed before the video starts playing, serving as a preview or loading image.
<fastpix-player playback-id="playback-id" placeholder="loading-image.jpg"></fastpix-player>
The thumbnail-time
attribute in allows you to specify a particular time (in seconds) within the video to capture a frame for the thumbnail. This enables setting a custom thumbnail image from a specific moment in the video, rather than using a default thumbnail.
<fastpix-player playback-id="playback-id" thumbnail-time={8}></fastpix-player>
Customize keyboard shortcuts with hot-keys
for efficient video control and use disable-keyboard-controls
to disable keyboard interactions for enhanced accessibility or specific use cases.
hot-keys
: The hot-keys
attribute specifies custom keyboard shortcuts (e.g., KeyK, KeyC), but when set, control for these specific keys will be disabled within the .<fastpix-player playback-id="your-playback-id" hot-keys="KeyK KeyC" ></fastpix-player>
The available keys are - KeyK
, KeyC
, KeyF
, KeyM
, ArrowLeft
, ArrowRight
, ArrowUp
, ArrowDown
, Space
;
disable-keyboard-controls
: The disable-keyboard-controls
attribute disables all keyboard interactions for video playback within the , preventing any keyboard shortcuts from being used.<fastpix-player playback-id="your-playback-id" hot-keys="KeyK KeyC" ></fastpix-player>
The chapters
feature lets you divide your video into sections, making navigation easier for users. Each chapter has a startTime, optional endTime, and a title. This is useful for allowing users to jump to specific parts of a video quickly.
Below is a simple example of how to add chapters to the and listen for events like timeupdate
and chapterchange
:
<script>
document.addEventListener('DOMContentLoaded', () => {
const fpPlayerElement = document.querySelector('fastpix-player');
fpPlayerElement.addEventListener('timeupdate', (event) => {
const currentTime = fpPlayerElement.currentTime;
console.log('Current Time:', currentTime);
});
const chapters = [
{ startTime: 0, endTime: 2, value: 'chapter-1' },
{
startTime: 4,
value: 'Chapter 2'
},
{
startTime: 5,
endTime: 6,
value: 'Chapter 3'
},
];
function addChaptersToPlayer() {
if (fpPlayerElement && typeof fpPlayerElement.addChapters === 'function') {
fpPlayerElement.addChapters(chapters);
} else {
console.error('addChapters method not found on fpPlayerElement');
}
}
console.log("Source URL:", fpPlayerElement.currentSrc);
console.log("readyState:", fpPlayerElement.readyState);
console.log("buffered:", fpPlayerElement.buffered);
// Wait until the player has loaded some data to associate chapters
if (fpPlayerElement && fpPlayerElement.readyState >= 1) {
addChaptersToPlayer();
} else {
if (fpPlayerElement) {
fpPlayerElement.addEventListener('loadedmetadata', addChaptersToPlayer, { once: true });
} else {
console.error('fpPlayerElement not found');
}
}
if (fpPlayerElement) {
fpPlayerElement.addEventListener('chapterchange', () => {
console.log('Chapter change event detected');
console.log("Active Chapter:", fpPlayerElement.activeChapter());
console.log("Chapters:", fpPlayerElement.chapters);
});
fpPlayerElement.addEventListener('error', () => {
console.log('Error detected');
console.log("Active Chapter:", fpPlayerElement.activeChapter());
});
} else {
console.error('fpPlayerElement not found');
}
});
</script>
With convertOpenAIChapters
Method:
If your chapters are generated by OpenAI, you can use the convertOpenAIChapters
method to easily format them for the player:
<script>
document.addEventListener('DOMContentLoaded', () => {
const fpPlayerElement = document.querySelector('fastpix-player');
// Assuming OpenAI returns chapter data
const openAIchapters = [
{ startTime: 0, value: 'Chapter 1' },
{ startTime: 4, value: 'Chapter 2' },
{ startTime: 5, value: 'Chapter 3' },
];
// Convert OpenAI chapters to the right format
const chapters = convertOpenAIChapters(openAIchapters);
function addChaptersToPlayer() {
if (fpPlayerElement && typeof fpPlayerElement.addChapters === 'function') {
fpPlayerElement.addChapters(chapters);
} else {
console.error('addChapters method not found');
}
}
if (fpPlayerElement && fpPlayerElement.readyState >= 1) {
addChaptersToPlayer();
} else {
fpPlayerElement.addEventListener('loadedmetadata', addChaptersToPlayer);
}
});
</script>
Key Steps in the Code :
Chapter Definition: Chapters are defined in an array, with each chapter having a startTime
, endTime
, and value
.
Event Listeners: The code listens for timeupdate
to monitor playback, and loadedmetadata
to ensure the player is ready before adding chapters.
Adding Chapters: The chapters are added to the player with the addChapters method
, which should be supported by the element.
Handling Events: The code handles chapterchange
and error events to track chapter changes and errors during playback.
Without convertOpenAIChapters : You manually format and add the chapters.
With convertOpenAIChapters: You automatically convert OpenAI's chapter data into the proper format for the player.
This simplifies adding chapters to the player, especially when dealing with large sets of data from external sources.
The fastpix-player
provides extensive options to customize the player's appearance and behavior through CSS variables. These options allow you to tailor the look and feel of the player to match your application's branding and user experience preferences. Customize elements such as buttons, controls, and visual themes for complete flexibility in your video player integration.
Explore detailed guides for all features.
Customize the visibility of fastpix-player
theme colors with accent-color
, primary-color
, and secondary-color
to align with your branding and theme. These attributes are optional and can be tailored based on your preferences.
For Example:
<fastpix-player
playback-id="your-live-playback-id"
accent-color="red"
primary-color="#F5F5F5"
secondary-color="transparent">
</fastpix-player>
The options mentioned below help customize the visibility of different UI controls, enabling you to create a minimalistic or fully-featured player interface according to your needs.
--controls
: Controls the visibility of all the controls in the player.
--time-display
: Controls the visibility of the time display on the player.
--volume-control
: Toggles the visibility of the volume control on desktop.
--title
: Hides or shows the video title.
--play-button-initialized
: Hides or shows the play button after the player is initialized.
--forward-skip-button
: Controls the visibility of the forward skip button.
--audio-track-button
: Controls the visibility of the audio track button.
--cc-button
: Hides or shows the subtitle button.
--backward-skip-button
: Controls the visibility of the backward skip button.
--resolution-selector
: Hides or shows the resolution selector for video quality control.
--playback-rate-button
: Hides or shows the playback rate button for adjusting video speed.
--progress-bar
: Toggles the visibility of the progress bar.
--pip-button
: Controls the visibility of the Picture-in-Picture button.
--full-screen-button
: Toggles the visibility of the fullscreen button.
--volume-control-mobile
: Controls the visibility of the volume control on mobile devices.
--initial-play-button
: Hides or shows the initial play button before the video starts playing.
--middle-controls-mobile
: Toggles the visibility of the mobile middle controls.
-loading-indicator
: Controls the visibility of the loading indicator.
--left-controls-bottom-mobile
: Controls the visibility of the bottom-left controls on mobile devices.
--bottom-right-controls-mobile
: Controls the visibility of the bottom-right controls on mobile devices.
--bottom-right-controls
: Controls the visibility of the bottom-right controls on desktop devices.
--left-controls-bottom
: Controls the visibility of the bottom-left controls on desktop devices.
fastpix-player {
--volume-control: none;
--cc-button: none;
--title: none;
}
fastpix-player {
--controls: none;
}
fastpix-player {
--left-controls-bottom-mobile: none;
--bottom-right-controls-mobile: none;
--bottom-right-controls: none;
--left-controls-bottom: none;
}
You can set the aspect ratio of the player using the aspect-ratio
CSS variable, allowing you to maintain the desired width-to-height ratio for the video player.
fastpix-player {
aspect-ratio: 21/9;
}
The --backdrop-color
CSS variable allows you to customize the background color of the player controls, enabling you to match the player’s appearance with your application's theme and design.
fastpix-player {
--backdrop-color: rgba(0, 0, 0, 0.6); /* Semi-transparent dark background */
}
Each of these features is designed to enhance both flexibility and user experience, providing complete control over video playback, appearance, and user interactions in FastPix-player.
FAQs
FastPix Player SDK is a customizable video player for on-demand and live streaming.
The npm package @fastpix/fastpix-player receives a total of 0 weekly downloads. As such, @fastpix/fastpix-player popularity was classified as not popular.
We found that @fastpix/fastpix-player demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.