1.1.956 • Published 1 year ago

video-template v1.1.956

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Video Template

Template model describing video structure

Installing

$ npm install video-template

Example

parse template

const Template = require("video-template").Template;
const template = Template.parse("...XML Content...");
template.toXML(true);  //export pretty XML

build template

const { Template, Scene, elements: { Text } } = require("video-template");
const template = new Template({ width: 1920, height: 1080, aspectRatio: "16:9" });
const scene = new Scene({ width: 1920, height: 1080, duration: 5000 });
const text = new Text({ value: "Hello World" });
scene.appendChild(text);
template.appendChild(scene);
template.toXML(true);  //export pretty XML
JSON.stringify(template);  //export JSON

compile template

Add the compile attribute to the template tag.

<template ... compile>
const Template = require("video-template").Template;
const template = Template.parse("...Raw XML Content...");
template.toXML(true);  //export compiled pretty XML

raw xml:

<?xml version="1.0"?>
<data>
    <base>/files/</base>
    <name>Test Video</name>
    <mode>scene</mode>
    <width>1080</width>
    <height>1920</height>
    <aspectRatio>9:16</aspectRatio>
    <fps>60</fps>
    <date>2022-03-02</date>
    <text>Hello World</text>
</data>
<vars>

</vars>
<template name="{{name}}" mode="{{mode}}" poster="{{base}}cover.png" width="{{width}}" height="{{height}}" aspectRatio="{{aspectRatio}}" fps="{{fps}}" compile>
    <audio src="{{base}}audios/bgm.mp3" volume="0.2" loop="true"/>
    <scene width="{{width}}" height="{{height}}" duration="5000" transition-type="wipeLeft" transition-duration="300" for="{{2}}">
        <video x="0" y="0" width="{{width}}" height="{{height}}" src="{{base}}videos/pt.mp4" volume="1" loop="false" muted="false"/>
        <image x="270" y="220" width="70" height="60" zIndex="2" src="{{base}}images/left_jt.png"/>
        <image x="740" y="220" width="70" height="60" zIndex="2" src="{{base}}images/left_jt.png"/>
        <text x="393" y="200" width="295" height="80" zIndex="2" enterEffect-type="fadeInUp" enterEffect-duration="500" startTime="500" fontFamily="HarmonyOS_Sans_SC_Regular" fontSize="80" fontWeight="400" fontColor="#000000">Test</text>
        <text x="0" y="1640" width="1080" height="32" textAlign="center" zIndex="2" enterEffect-type="fadeInUp" enterEffect-duration="500" startTime="500" fontFamily="HarmonyOS_Sans_SC_Regular" fontSize="32" fontWeight="400" fontColor="#FFFFFF">{{date}}</text>
        <voice startTime="500" volume="100" loop="false" playbackRate="1" muted="false" provider="microsoft" text="{{text}}" declaimer="xiaoxiao" speechRate="0"/>
    </scene>
</template>

compiled xml:

<?xml version="1.0"?>
<template version="2.0.0" id="1bb0da20b6df11ecb40a272b48f69d94" name="Test Video" mode="scene" poster="/files/cover.png" width="1080" height="1920" aspectRatio="9:16" fps="60" duration="10000" volume="1" createTime="1649382990" updateTime="1649382990" buildBy="system">
  <audio id="1u4EA6WQNpbLUbuJ" src="/files/audios/bgm.mp3" volume="0.2" loop="true" muted="false"/>
  <scene id="1U4ea6OYPg24XOFQ" width="1080" height="1920" duration="5000" transition-type="wipeLeft" transition-duration="300">
    <video id="1U4Ea65wvvMlLooU" x="0" y="0" width="1080" height="1920" src="/files/videos/pt.mp4" volume="1" loop="false" muted="false"/>
    <image id="1U4Ea6lbmxlbtWi8" x="270" y="220" width="70" height="60" zIndex="2" src="/files/images/left_jt.png" mode="scaleToFill"/>
    <image id="1u4EA6pcZTp317rE" x="740" y="220" width="70" height="60" zIndex="2" src="/files/images/left_jt.png" mode="scaleToFill"/>
    <text id="1u4eA6zA6iISnMjX" x="393" y="200" width="295" height="80" zIndex="2" enterEffect-type="fadeInUp" enterEffect-duration="500" enterEffect-easing="0" startTime="500" fontFamily="HarmonyOS_Sans_SC_Regular" fontSize="80" fontWeight="400" fontColor="#000000" lineHeight="1" wordSpacing="0" lineWrap="false">Test</text>
    <text id="1U4eA62BmlWhk4nT" x="0" y="1640" width="1080" height="32" zIndex="2" enterEffect-type="fadeInUp" enterEffect-duration="500" enterEffect-easing="0" startTime="500" fontFamily="HarmonyOS_Sans_SC_Regular" fontSize="32" fontWeight="400" fontColor="#FFFFFF" lineHeight="1" wordSpacing="0" textAlign="center" lineWrap="false">2022-03-02</text>
    <voice id="1U4EA6ylkOofmQQF" startTime="500" volume="100" loop="false" playbackRate="1" muted="false" provider="microsoft" text="Hello World" declaimer="xiaoxiao" speechRate="0"/>
  </scene>
  <scene id="1u4eA64X3zD0D33P" width="1080" height="1920" duration="5000" transition-type="wipeLeft" transition-duration="300">
    <video id="1u4eA6GChkjJYXuL" x="0" y="0" width="1080" height="1920" src="/files/videos/pt.mp4" volume="1" loop="false" muted="false"/>
    <image id="1u4eA6PgFzKBvjut" x="270" y="220" width="70" height="60" zIndex="2" src="/files/images/left_jt.png" mode="scaleToFill"/>
    <image id="1U4eA66yCPZbzgDO" x="740" y="220" width="70" height="60" zIndex="2" src="/files/images/left_jt.png" mode="scaleToFill"/>
    <text id="1U4eA6GO1B7v8kXb" x="393" y="200" width="295" height="80" zIndex="2" enterEffect-type="fadeInUp" enterEffect-duration="500" enterEffect-easing="0" startTime="500" fontFamily="HarmonyOS_Sans_SC_Regular" fontSize="80" fontWeight="400" fontColor="#000000" lineHeight="1" wordSpacing="0" lineWrap="false">Test</text>
    <text id="1U4Ea6SqCMZXUZS1" x="0" y="1640" width="1080" height="32" zIndex="2" enterEffect-type="fadeInUp" enterEffect-duration="500" enterEffect-easing="0" startTime="500" fontFamily="HarmonyOS_Sans_SC_Regular" fontSize="32" fontWeight="400" fontColor="#FFFFFF" lineHeight="1" wordSpacing="0" textAlign="center" lineWrap="false">2022-03-02</text>
    <voice id="1u4ea6waczrOHFIJ" startTime="500" volume="100" loop="false" playbackRate="1" muted="false" provider="microsoft" text="Hello World" declaimer="xiaoxiao" speechRate="0"/>
  </scene>
</template>
1.1.92

1 year ago

1.1.91

2 years ago

1.1.95

1 year ago

1.1.94

1 year ago

1.1.93

1 year ago

1.1.921

1 year ago

1.1.892

2 years ago

1.1.891

2 years ago

1.1.89

2 years ago

1.1.88

2 years ago

1.1.87

2 years ago

1.1.8833

2 years ago

1.1.8832

2 years ago

1.1.8831

2 years ago

1.1.9

2 years ago

1.1.881

2 years ago

1.1.884

2 years ago

1.1.883

2 years ago

1.1.882

2 years ago

1.1.944

1 year ago

1.1.943

1 year ago

1.1.942

1 year ago

1.1.941

1 year ago

1.1.933

1 year ago

1.1.932

1 year ago

1.1.931

1 year ago

1.1.956

1 year ago

1.1.948

1 year ago

1.1.947

1 year ago

1.1.946

1 year ago

1.1.945

1 year ago

1.1.955

1 year ago

1.1.954

1 year ago

1.1.953

1 year ago

1.1.952

1 year ago

1.1.951

1 year ago

1.1.8681

2 years ago

1.1.8652

2 years ago

1.1.8651

2 years ago

1.1.8691

2 years ago

1.1.8581

2 years ago

1.1.858

2 years ago

1.1.857

2 years ago

1.1.867

2 years ago

1.1.866

2 years ago

1.1.865

2 years ago

1.1.864

2 years ago

1.1.863

2 years ago

1.1.862

2 years ago

1.1.861

2 years ago

1.1.860

2 years ago

1.1.856

2 years ago

1.1.855

2 years ago

1.1.869

2 years ago

1.1.868

2 years ago

1.1.8631

2 years ago

1.1.694

2 years ago

1.1.693

2 years ago

1.1.692

2 years ago

1.1.691

2 years ago

1.1.698

2 years ago

1.1.697

2 years ago

1.1.696

2 years ago

1.1.695

2 years ago

1.1.3999

2 years ago

1.1.8531

2 years ago

1.1.3881

2 years ago

1.1.419

2 years ago

1.1.418

2 years ago

1.1.417

2 years ago

1.1.661

2 years ago

1.1.74

2 years ago

1.1.73

2 years ago

1.1.72

2 years ago

1.1.8471

2 years ago

1.1.71

2 years ago

1.1.78

2 years ago

1.1.77

2 years ago

1.1.76

2 years ago

1.1.75

2 years ago

1.1.79

2 years ago

1.1.81

2 years ago

1.1.771

2 years ago

1.1.83

2 years ago

1.1.82

2 years ago

1.1.779

2 years ago

1.1.416

2 years ago

1.1.778

2 years ago

1.1.415

2 years ago

1.1.777

2 years ago

1.1.414

2 years ago

1.1.776

2 years ago

1.1.413

2 years ago

1.1.775

2 years ago

1.1.412

2 years ago

1.1.774

2 years ago

1.1.411

2 years ago

1.1.773

2 years ago

1.1.410

2 years ago

1.1.772

2 years ago

1.1.52

2 years ago

1.1.8451

2 years ago

1.1.51

2 years ago

1.1.56

2 years ago

1.1.55

2 years ago

1.1.54

2 years ago

1.1.53

2 years ago

1.1.59

2 years ago

1.1.58

2 years ago

1.1.57

2 years ago

1.1.63

2 years ago

1.1.8462

2 years ago

1.1.62

2 years ago

1.1.8461

2 years ago

1.1.61

2 years ago

1.1.67

2 years ago

1.1.66

2 years ago

1.1.65

2 years ago

1.1.64

2 years ago

1.1.69

2 years ago

1.1.68

2 years ago

1.1.849

2 years ago

1.1.848

2 years ago

1.1.847

2 years ago

1.1.846

2 years ago

1.1.3951

2 years ago

1.1.854

2 years ago

1.1.853

2 years ago

1.1.852

2 years ago

1.1.851

2 years ago

1.1.850

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3982

2 years ago

1.1.386

2 years ago

1.1.3983

2 years ago

1.1.385

2 years ago

1.1.384

2 years ago

1.1.3981

2 years ago

1.1.383

2 years ago

1.1.389

2 years ago

1.1.388

2 years ago

1.1.387

2 years ago

1.1.3993

2 years ago

1.1.3994

2 years ago

1.1.3991

2 years ago

1.1.3992

2 years ago

1.1.3997

2 years ago

1.1.3998

2 years ago

1.1.3995

2 years ago

1.1.3996

2 years ago

1.1.836

2 years ago

1.1.835

2 years ago

1.1.3961

2 years ago

1.1.3962

2 years ago

1.1.845

2 years ago

1.1.844

2 years ago

1.1.843

2 years ago

1.1.842

2 years ago

1.1.841

2 years ago

1.1.840

2 years ago

1.1.397

2 years ago

1.1.396

2 years ago

1.1.395

2 years ago

1.1.393

2 years ago

1.1.392

2 years ago

1.1.391

2 years ago

1.1.390

2 years ago

1.1.834

2 years ago

1.1.833

2 years ago

1.1.832

2 years ago

1.1.831

2 years ago

1.1.399

2 years ago

1.1.398

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.862

2 years ago

1.0.861

2 years ago

1.1.382

2 years ago

1.1.381

2 years ago

1.1.34

2 years ago

1.1.33

2 years ago

1.1.32

2 years ago

1.1.31

2 years ago

1.1.38

2 years ago

1.1.37

2 years ago

1.1.36

2 years ago

1.1.35

2 years ago

1.1.375

2 years ago

1.1.374

2 years ago

1.1.373

2 years ago

1.1.372

2 years ago

1.1.371

2 years ago

1.0.73

2 years ago

1.0.72

2 years ago

1.0.71

2 years ago

1.0.77

2 years ago

1.0.76

2 years ago

1.0.75

2 years ago

1.1.379

2 years ago

1.1.378

2 years ago

1.1.377

2 years ago

1.0.79

2 years ago

1.1.376

2 years ago

1.0.78

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.364

2 years ago

1.1.363

2 years ago

1.1.362

2 years ago

1.1.361

2 years ago

1.0.84

2 years ago

1.0.83

2 years ago

1.0.82

2 years ago

1.0.81

2 years ago

1.0.88

2 years ago

1.0.87

2 years ago

1.0.86

2 years ago

1.1.369

2 years ago

1.0.85

2 years ago

1.1.368

2 years ago

1.1.367

2 years ago

1.1.366

2 years ago

1.1.365

2 years ago

1.0.89

2 years ago

1.0.91

2 years ago

1.0.95

2 years ago

1.0.94

2 years ago

1.0.93

2 years ago

1.0.92

2 years ago

1.0.99

2 years ago

1.0.98

2 years ago

1.0.97

2 years ago

1.0.96

2 years ago

1.0.61

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago