{"id":21832041,"url":"https://github.com/dailymotion/vmap-js","last_synced_at":"2025-05-07T01:47:50.491Z","repository":{"id":41322402,"uuid":"43532471","full_name":"dailymotion/vmap-js","owner":"dailymotion","description":"A VMAP JavaScript Library","archived":false,"fork":false,"pushed_at":"2025-01-23T14:33:01.000Z","size":602,"stargazers_count":28,"open_issues_count":0,"forks_count":4,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-05-01T00:24:22.648Z","etag":null,"topics":["hacktoberfest","javascript","vmap"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dailymotion.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"2015-10-02T02:34:47.000Z","updated_at":"2025-04-27T09:05:02.000Z","dependencies_parsed_at":"2024-02-20T10:42:19.559Z","dependency_job_id":"b6d4c452-2252-4e34-b7d3-e022b6e97bf3","html_url":"https://github.com/dailymotion/vmap-js","commit_stats":{"total_commits":81,"total_committers":9,"mean_commits":9.0,"dds":0.7407407407407407,"last_synced_commit":"e7699083b769fd1c8f070dd9050562a568a8213e"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dailymotion%2Fvmap-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dailymotion%2Fvmap-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dailymotion%2Fvmap-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dailymotion%2Fvmap-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dailymotion","download_url":"https://codeload.github.com/dailymotion/vmap-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252798777,"owners_count":21805880,"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":["hacktoberfest","javascript","vmap"],"created_at":"2024-11-27T19:17:24.764Z","updated_at":"2025-05-07T01:47:50.468Z","avatar_url":"https://github.com/dailymotion.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VMAP Javascript Library\n\n[![Build Status](https://img.shields.io/badge/build-passing-brightgreen)](https://travis-ci.org/dailymotion/vmap-js)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![npm version](https://badge.fury.io/js/vmap.svg)](https://badge.fury.io/js/vmap)\n\nParse a VMAP XML document to Javascript object. Complies with [VMAP 1.0.1 spec](http://www.iab.net/media/file/VMAP.pdf).\n\n## Installation\n\nInstall with npm\n```\nnpm install @dailymotion/vmap\n```\n\n## Usage\n\nProvide the `VMAP` constructor an XML in order to have a parsed version of it.\n\nAccess `VMAP` properties using the APIs documented below.\n\n``` javascript\nimport VMAP from '@dailymotion/vmap';\n\n// Fetch VMAP as XML\nfetch(vmapURL)\n    .then(response =\u003e response.text())\n    .then(xmlText =\u003e {\n        // Get a parsed VMAP object\n        const parser = new DOMParser();\n        const xmlDoc = parser.parseFromString(xmlText, 'text/xml');\n        const vmap = new VMAP(xmlDoc);\n    })\n    .catch(error =\u003e {\n        console.error('Error fetching VMAP:', error);\n    });\n```\n\n## API\n\n### VMAP\n\n#### Properties\n\n* `version`: The VMAP version (should be 1.0).\n* `adBreaks`: An array of `VMAPAdBreak` objects.\n* `extensions`: An array of `Object` with\n    * `children`: `Object` containing all this extension children and their name as the key\n    * `attribute`: `Object` containing all this extension attributes and their name as the key\n    * `value`: `Object` parsed from CDATA or as a fallback all of the text nodes of this extension concatenated\n\n### VMAPAdBreak\n\nProvides information about an ad break.\n\n#### Properties\n\n* `timeOffset`: Represents the timing of the ad break.\n* `breakType`: Identifies whether the ad break allows \"linear\", \"nonlinear\" or \"display\" ads.\n* `breakId`: An optional string identifier for the ad break.\n* `repeatAfter`: An option used to distribute ad breaks equally spaced apart from one another along a linear timeline.\n* `adSource`: A `VMAPAdSource` object.\n* `trackingEvents`: An array of `Object` with tracking URLs\n    * `event`: The name of the event to track for the element. Can be one of breakStart, breakEnd or error.\n    * `uri`: The URI of the tracker.\n* `extensions`: An array of `Object` with\n    * `children`: `Object` containing all this extension children and their name as the key\n    * `attribute`: `Object` containing all this extension attributes and their name as the key\n    * `value`: `Object` parsed from CDATA or as a fallback all of the text nodes of this extension concatenated\n\n#### Methods\n\n* `track(event, errorCode)`: Call the trackers for the given event with an option error code parameter for `error` events.\n\n### VMAPAdSource\n\nProvides the player with either an inline ad response or a reference to an ad response.\n\n#### Properties\n\n* `id`: Ad identifier for the ad source.\n* `allowMultipleAds`: Indicates whether a VAST ad pod or multple buffet of ads can be served into an ad break.\n* `followRedirects`: Indicates whether the video player should honor the redirects within an ad response.\n* `vastAdData`: Contains an embedded VAST response.\n* `adTagURI`: Contains a URI to the VAST.\n* `customData`: Contains custom ad data.\n\n## Support and compatibility\nThe library is 100% written in JavaScript and the source code uses modern features like `modules`, `classes`, ecc... . Make sure your environment supports these features, or transpile the library when bundling your project.\n\n### Pre-bundled versions\nWe provide several pre-bundled versions of the library (see [`dist` directory](dist/))\n\n#### Browser\nA pre-bundled version of VMAP-jsis available: [`vmap-js.js`](dist/vmap-js.js).\n\nYou can add the script directly to your page and access the library through the `VMAP` constructor.\n\n```html\n\u003cscript src=\"dist/vmap-js.js\"\u003e\u003c/script\u003e\n```\n\n```javascript\nvar vmap = new VMAP(vmapXML);\n```\n\n#### Node\nA pre-bundled version for node is available too: [`vmap-js-node.js`](dist/vmap-js-node.js).\n\n```javascript\nconst VMAP = require('@dailymotion/vmap')\n\nconst vmap = new VMAP(vmapXML);\n```\n\n## Build and tests\n\nInstall dependencies with:\n\n```\nnpm install\n```\n\nThe project is bundled using [Rollup](https://rollupjs.org/guide/en). Build with:\n\n```\nnpm run-script build\n```\n\nRun tests with:\n\n```\nnpm test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdailymotion%2Fvmap-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdailymotion%2Fvmap-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdailymotion%2Fvmap-js/lists"}