dash-manifest-creator
Advanced tools
Comparing version 1.0.4 to 1.0.6
@@ -24,12 +24,11 @@ /* | ||
import { saveAs } from 'file-saver' | ||
export class MPD { | ||
constructor (videoData = null) { | ||
this.doc = document.implementation.createDocument("", "", null) | ||
this.mpd = null | ||
class MPD { | ||
constructor (videoData = null, doc) { | ||
this.video = videoData | ||
this.doc = doc | ||
this.mpd = doc.createElement('MPD') | ||
} | ||
createMpd (videoData = this.video, mediaUrl = '', startNumber = "1") { | ||
createMpd (videoData = this.video, mediaUrl = '', startNumber = 1) { | ||
const date = new Date(Date.now()).toISOString() | ||
this.mpd = this.doc.createElement('MPD') | ||
this.mpd.setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance') | ||
@@ -47,3 +46,3 @@ this.mpd.setAttribute('xmlns', 'urn:mpeg:dash:schema:mpd:2011') | ||
const st = this.createSegmentTemplate(as, "1000", "2000", startNumber, videoData, mediaUrl) | ||
return this.doc | ||
} | ||
@@ -75,2 +74,3 @@ | ||
createSegmentTemplate (el, timescale = "1000", duration = "2000", startNumber = "1", videoData = this.video, media = '') { | ||
console.log('MEDIA:::',decodeURI(media)) | ||
const st = this.doc.createElement('SegmentTemplate') | ||
@@ -83,2 +83,3 @@ st.setAttribute('timescale', timescale) | ||
el.appendChild(st) | ||
console.log('ST:::', st) | ||
return st | ||
@@ -94,5 +95,6 @@ } | ||
const xml = new XMLSerializer() | ||
const str = xml.serializeToString(this.mpd) | ||
let str = xml.serializeToString(this.mpd) | ||
str = str.replaceAll('&', '&') | ||
const file = new Blob([str], { | ||
type: "text/xml", | ||
type: "application/xml", | ||
}) | ||
@@ -102,1 +104,4 @@ return file | ||
} | ||
export { | ||
MPD | ||
} |
{ | ||
"name": "dash-manifest-creator", | ||
"version": "1.0.4", | ||
"version": "1.0.6", | ||
"description": "A pure javascript package for creating MPEG-DASH manifests in the browser.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4213
98