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.
@api.video/player-analytics
Advanced tools
Changelog
[1.0.10] - 2022-08-30
Readme
api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.
Javascript module to manually call the api.video analytics collector.
This is useful if you are using a video player for which we do not yet provide a ready-to-use monitoring module.
If you use one of the following video player, you should rather use the associated packaged monitoring module:
Player | monitoring module |
---|---|
video.js | @api.video/api.video-videojs-analytics |
hls.js | @api.video/api.video-hlsjs-analytics |
This module is compatible with React Native.
If you use requirejs you can add the module as a dependency to your project with
$ npm install --save @api.video/player-analytics
You can then use the module in your script:
var { PlayerAnalytics } = require('@api.video/player-analytics');
const playerAnalytics = new PlayerAnalytics({
...options // see below for available options
});
If you use Typescript you can add the SDK as a dependency to your project with
$ npm install --save @api.video/player-analytics
You can then use the SDK in your script:
import { PlayerAnalytics } from '@api.video/player-analytics'
const playerAnalytics = new PlayerAnalytics({
...options // see below for available options
});
Include the SDK in your HTML file like so:
<head>
...
<script src="https://unpkg.com/@api.video/player-analytics" defer></script>
</head>
Then, once the window.onload
event has been trigered, instanciate the module with new PlayerAnalytics()
:
<script type="text/javascript">
var playerAnalytics = new PlayerAnalytics("#target", {
...options // see below for available options
});
</script>
The analytics module constructor takes a PlayerAnalyticsOptions
parameter that contains the following options:
Option name | Mandatory | Type | Description |
---|---|---|---|
mediaUrl | yes | string | url of the media (eg. https://cdn.api.video/vod/vi5oDagRVJBSKHxSiPux5rYD/hls/manifest.m3u8 ) |
userMetadata | no | { [name: string]: string }[] | object containing metadata (see Full example below) |
sequence | no | {start: number; end?: number;} | if only a sequence of the video is going to be played |
onSessionIdReceived | no | (sessionId: string) => void | callback to be called once the session id is reveiced |
Once the module is instanciated, the following methods have to be called to monitor the playback events.
play(): Promise<void>
method to call when the video starts playing for the first time (in the case of a resume after paused, use
resume()
)
resume(): Promise<void>
method to call when the video playback is resumed after a pause
ready(): Promise<void>
method to call once the player is ready to play the media
end(): Promise<void>
method to call when the video is ended
seek(from: number, to: number): Promise<void>
method to call when a seek event occurs, the
from
andto
parameters are mandatory and should contains the seek start & end times in seconds
pause(): Promise<void>
method to call when the video is paused
destroy(): Promise<void>
method to call when the video player is disposed (eg. when the use closes the navigation tab)
updateTime(time: number): Promise<void>
method to call each time the playback time changes (it should be called often, the accuracy of the collected data depends on it)
FAQs
api.video player analytics module
The npm package @api.video/player-analytics receives a total of 20 weekly downloads. As such, @api.video/player-analytics popularity was classified as not popular.
We found that @api.video/player-analytics demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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.