Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
p2p-media-loader-shaka
Advanced tools
Readme
P2P sharing of segmented media streams (i.e. HLS, MPEG-DASH) using WebRTC for Shaka Player
Useful links:
General steps are:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Shaka Player with P2P Media Loader</title>
<meta charset="utf-8">
<script src="https://cdn.jsdelivr.net/npm/p2p-media-loader-core@latest/build/p2p-media-loader-core.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/p2p-media-loader-shaka@latest/build/p2p-media-loader-shaka.min.js"></script>
<script src="https://github.com/videojs/mux.js/releases/download/v4.4.0/mux.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/shaka-player/2.4.4/shaka-player.compiled.js"></script>
</head>
<body>
<video id="video" width="640" controls autoplay muted></video>
<script>
shaka.polyfill.installAll();
if (shaka.Player.isBrowserSupported() && p2pml.shaka.Engine.isSupported()) {
function onError(error) { console.error("Error code", error.code, "object", error); }
var engine = new p2pml.shaka.Engine();
var player = new shaka.Player(document.getElementById("video"));
player.addEventListener("error", function(event) { onError(event.detail); });
engine.initShakaPlayer(player);
player.load("https://akamai-axtest.akamaized.net/routes/lapd-v1-acceptance/www_c4/Manifest.mpd").catch(onError);
} else {
document.write("Not supported :(");
}
</script>
</body>
</html>
The library uses window.p2pml.shaka
as a root namespace in Web browser for:
Engine
- Shaka Player support engineversion
- API versionEngine
Shaka Player support engine.
Engine.isSupported()
Returns result from p2pml.core.HybridLoader.isSupported()
.
engine = new Engine([settings])
Creates a new Engine
instance.
settings
structure:
segments
forwardSegmentCount
- Number of segments for building up predicted forward segments sequence; used to predownload and share via P2P. Default is 20.maxHistorySegments
- Maximum amount of requested segments manager should remember; used to build up sequence with correct priorities for P2P sharing. Default is 50.swarmId
- Override default swarm ID that is used to identify unique media stream with trackers (manifest URL without query parameters is used as the swarm ID if the parameter is not specified).assetsStorage
- A storage for the downloaded assets: manifests, subtitles, init segments, DRM assets etc. By default the assets are not stored. Can be used to implement offline plabyack. See AssetsStorage interface for details.loader
HybridLoader
(see P2P Media Loader Core API for details).interface Asset {
masterSwarmId: string;
masterManifestUri: string;
requestUri: string;
requestRange?: string;
responseUri: string;
data: ArrayBuffer;
}
interface AssetsStorage {
storeAsset(asset: Asset): Promise<void>;
getAsset(requestUri: string, requestRange: string | undefined, masterSwarmId: string): Promise<Asset | undefined>;
destroy(): Promise<void>;
}
engine.on(event, handler)
Registers an event handler.
event
- Event you want to handle; available events you can find here.handler
- Function to handle the eventengine.getSettings()
Returns engine instance settings.
engine.getDetails()
Returns engine instance details.
engine.destroy()
Destroys engine; destroy loader and segment manager.
engine.initShakaPlayer(player)
Shaka Player integration.
player
should be valid Shaka Player instance.
Example
shaka.polyfill.installAll();
var engine = new p2pml.shaka.Engine();
var video = document.getElementById("video");
var player = new shaka.Player(video);
engine.initShakaPlayer(player);
player.load("https://example.com/path/to/your/dash.mpd");
FAQs
P2P Media Loader Shaka Player integration
The npm package p2p-media-loader-shaka receives a total of 13 weekly downloads. As such, p2p-media-loader-shaka popularity was classified as not popular.
We found that p2p-media-loader-shaka demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.