{"id":13612083,"url":"https://github.com/basil79/ads-manager","last_synced_at":"2025-04-09T12:08:32.494Z","repository":{"id":41890103,"uuid":"439575931","full_name":"basil79/ads-manager","owner":"basil79","description":"HTML5 Video Ads Manager based on @dailymotion/vast-client","archived":false,"fork":false,"pushed_at":"2025-03-25T19:15:32.000Z","size":987,"stargazers_count":31,"open_issues_count":2,"forks_count":16,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-02T11:06:42.960Z","etag":null,"topics":["ad","ad-manager","adpod","ads-manager","advertising","iab","instream-video-ads","javascript","outstream-video-ads","vast","vast-client","vast-client-js","video","video-ads","video-player","vmap","vpaid"],"latest_commit_sha":null,"homepage":"https://adserve.tv","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/basil79.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-18T09:31:44.000Z","updated_at":"2025-03-25T07:13:08.000Z","dependencies_parsed_at":"2024-05-12T17:47:22.654Z","dependency_job_id":"335bb070-6483-4032-902e-222f353410d2","html_url":"https://github.com/basil79/ads-manager","commit_stats":{"total_commits":104,"total_committers":4,"mean_commits":26.0,"dds":0.4903846153846154,"last_synced_commit":"06b78c0892d370c9b422f60b5e516af21e108b2e"},"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basil79%2Fads-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basil79%2Fads-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basil79%2Fads-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basil79%2Fads-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/basil79","download_url":"https://codeload.github.com/basil79/ads-manager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248036067,"owners_count":21037092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ad","ad-manager","adpod","ads-manager","advertising","iab","instream-video-ads","javascript","outstream-video-ads","vast","vast-client","vast-client-js","video","video-ads","video-player","vmap","vpaid"],"created_at":"2024-08-01T20:00:22.220Z","updated_at":"2025-04-09T12:08:32.478Z","avatar_url":"https://github.com/basil79.png","language":"JavaScript","funding_links":[],"categories":["HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"[![npm version](https://badgen.net/npm/v/ads-manager)](https://badgen.net/npm/v/ads-manager)\n[![downloads per week](https://badgen.net/npm/dw/ads-manager)](https://badgen.net/npm/dw/ads-manager)\n[![license](https://badgen.net/github/license/basil79/ads-manager)](https://badgen.net/github/license/basil79/ads-manager)\n\n# ads-manager\n\n\u003e HTML5 Video Ads Manager based on @dailymotion/vast-client\n\nThis SDK supports:\n\n- VAST versions 2.0, 3.0 and 4.0+ up to 4.2 (included) - Complies with the [VAST 4.2 specification](https://iabtechlab.com/wp-content/uploads/2019/06/VAST_4.2_final_june26.pdf) provided by the [Interactive Advertising Bureau (IAB)](https://www.iab.com/).\n- Inline Linear\n- Wrapper\n- AdPod\n- Tracker for VAST tracking events\n- Media Types (Assets):\n  - `video/mp4; codecs=“avc1.42E01E, mp4a.40.2”`\n  - `video/webm; codecs=“vp8, vorbis”`\n  - `video/ogg; codecs=“theora, vorbis”`\n  - `video/3gpp; codecs=“mp4v.20.8, samr”` (Safari)\n  - `application/javascript` (VPAID)\n- [VPAID 2.0](https://iabtechlab.com/wp-content/uploads/2016/04/VPAID_2_0_Final_04-10-2012.pdf)\n\nThis README is for developers who want to use and/or contribute to ads-manager.\n\n**Table of Contents**\n\n- [Usage](#Usage)\n- [Documentation](#Documentation)\n- [Install](#Install)\n- [Build](#Build)\n- [Run](#Run)\n- [Contribute](#Contribute)\n\n\n## Usage\n\n```javascript\nimport AdsManager from 'ads-manager';\n\n// Get your video element\nconst videoElement = document.getElementById('video-element');\n// Get your HTML element for ad container\nconst adContainer = document.getElementById('ad-container');\n// Define ads manager and pass ad container\nconst adsManager = new AdsManager(adContainer);\n// Subscribe for events\n// AdsManagerLoaded\nadsManager.addEventListener('AdsManagerLoaded', function() {\n  // Get height and width of your video element\n  let width = videoElement.clientWidth;\n  let height = videoElement.clientHeight;\n  let viewMode = 'normal'; // fullscreen\n  // Init\n  try {\n    adsManager.init(width, height, viewMode);\n  } catch (adError) {\n    // Play your context without ads, if an error occurs\n  }\n});\n// AdError\nadsManager.addEventListener('AdError', function(adError) {\n  if(adsManager) {\n    // Removes ad assets loaded at runtime that need to be properly removed at the time of ad completion\n    // and stops the ad and all tracking.\n    adsManager.abort();\n  }\n  // ... \n});\n// AdLoaded\nadsManager.addEventListener('AdLoaded', function(adEvent) {\n  // Ad loaded, awaiting start\n  // Check if ad type is linear\n  if(adEvent.isLinear()) {\n    try {\n      // Start ad\n      adsManager.start();\n    } catch (adError) {\n      // Play video content without ads in case of error\n    }\n  } else {\n    // Ad is not linear\n  }\n});\n// AdStarted\nadsManager.addEventListener('AdStarted', function() {\n  // Pause your video content\n  videoElement.pause();\n});\n// ...\n// AdDurationChange\n// AdSizeChange\n// AdImpression\n// AdVideoStart\n// AdVideoFirstQuartile\n// AdVideoMidpoint\n// AdVideoThirdQuartile\n// AdVideoComplete\n// AdPaused\n// AdPlaying\n// AdStopped\n// AdSkipped\n// AdClickThru\n// ...\n// AllAdsCompleted\nadsManager.addEventListener('AllAdsCompleted', function() {\n  // Play your video content\n  videoElement.play();\n});\n\n\n// VAST tag url\nlet vastUrl = 'your VAST tag url';\n\n// Request Ads\nadsManager.requestAds(vastUrl);\n\n/*\n// VAST XML\nlet vastXML = `\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n    \u003cVAST version=\"2.0\"\u003e\n      \u003cError\u003e\u003c![CDATA[http://example.com/empty-no-ad]]\u003e\u003c/Error\u003e\n    \u003c/VAST\u003e`;\nadsManager.requestAds(vastXML);\n */\n```\n\n## Documentation\n\nFor the full documentation:\n\n* [AdsManager](docs/ADSMANAGER.md)\n\n### Pre-bundled versions\n\n#### Browser script\n\nA pre-bundled version of ads-manager is available: [`ads-manager.js`](dist/ads-manager.js) [minified].\n\nYou can add the script directly to your page and access the library's components through the `adserve` object.\n\n```html\n\u003cscript src=\"ads-manager.js\"\u003e\u003c/script\u003e\n```\n\n```javascript\n// Get your HTML element for ad container\nconst adContainer = document.getElementById('ad-container');\n// Define ads manager and pass ad container\nconst adsManager = new adserve.AdsManager(adContainer);\n```\n\n## Install\n\n### Get Started\n\nads-manager is available as an NPM package and can be easily installed with:\n\n    $ npm i ads-manager \n\n### Using Git\n\n    $ git clone https://github.com/basil79/ads-manager\n    $ cd ads-manager\n    $ npm ci\n\n\n## Build\n\nTo build the project for development:\n    \n    $ npm run build:dev\n\nTo build the project for production:\n\n    $ npm run build:prod\n\nThis will generate the following file:\n\n+ `./dist/ads-manager.js` - Minified browser production code\n\n## Run\n\n    $ npm start\n\nThen navigate to: http://localhost:8081 in your browser\n\n### Supported Browsers\n\nads-manager is supported all modern browsers.\n\n## Contribute\n\nSee [CONTRIBUTING](./CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasil79%2Fads-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasil79%2Fads-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasil79%2Fads-manager/lists"}