
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
@antmedia/web_player
Advanced tools
Web Player is a powerful, versatile player for Ant Media Server, designed to embed and play streams directly in web applications. It supports various stream types including WebRTC, HLS, DASH, and VR 360, ensuring broad compatibility and high performance. The player can be easily configured via URL parameters or directly in your code, offering both flexibility and ease of use.
Install the Web Player package using npm:
npm i @antmedia/web_player
To use the Web Player, import it and initialize it with the parameters received from the URL. Refer to the Configuration Parameters section below for more details.
<div id="video_container" ></div>
import { WebPlayer } from "@antmedia/web_player";
var embeddedPlayer = new WebPlayer(window, document.getElementById("video_container"), null);
embeddedPlayer.initialize().then(() => {
embeddedPlayer.play();
});
The sample for this usage is available in play.html in StreamApp
Alternatively, you can pass the parameters as an object to the WebPlayer constructor.
<div id="video_container" ></div>
var player = new WebPlayer({
streamId: "myStreamId",
httpBaseURL: "http://example.antmedia.io:5080/WebRTCAppEE/", //Remember to add trailing slash(/)
}, document.getElementById("video_container"), null);
player.initialize().then(() => {
player.play();
}).catch((error) => {
console.error("Error while initializing embedded player: " + error);
});
The sample for this usage is available in app.page.component.ts in Ant-Media-Management-Console
The player accepts several configuration parameters, either through the URL or directly in the code:
id
(String): The stream ID to play. This parameter is mandatory.token
(String): The token for stream access. It's mandatory if token security is enabled on the server side.autoplay
(Boolean): Autoplay the stream if available. Optional. Default value is true
.mute
(Boolean): Start playing in mute mode if the stream is available. Optional. Default value is true
.playOrder
(String): The order of technologies used for playing. Optional. Default value is "webrtc,hls"
. Possible values include "hls,webrtc"
, "webrtc"
, "hls"
, "vod"
, "dash"
.playType
(String): The order of play types used for playing. Optional. Default value is "mp4,webm"
. Possible values include "webm,mp4"
, "mp4"
, "webm"
, "mov"
.targetLatency
(Number): The target latency for the DASH player. Optional. Default value is 3
.is360
(Boolean): Enable playback in 360 mode. Optional. Default value is false
.For support and further inquiries, please visit Ant Media Server's community. If you are an enterprise user, you can receive support by sending an email to support@antmedia.io.
For reporting issues, please create them on the Ant-Media-Server issues page.
Contributions are warmly welcomed. If you would like to help improve the Web Player, please submit your pull requests to the repository or report any issues you encounter.
Enjoy streaming with the Ant Media Server's Web Player!
FAQs
Ant Media Server Player that can play WebRTC, HLS, DASH
The npm package @antmedia/web_player receives a total of 535 weekly downloads. As such, @antmedia/web_player popularity was classified as not popular.
We found that @antmedia/web_player demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.