1.1.956 • Published 3 years ago

video-template v1.1.956

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years 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

3 years ago

1.1.91

3 years ago

1.1.95

3 years ago

1.1.94

3 years ago

1.1.93

3 years ago

1.1.921

3 years ago

1.1.892

3 years ago

1.1.891

3 years ago

1.1.89

3 years ago

1.1.88

3 years ago

1.1.87

3 years ago

1.1.8833

3 years ago

1.1.8832

3 years ago

1.1.8831

3 years ago

1.1.9

3 years ago

1.1.881

3 years ago

1.1.884

3 years ago

1.1.883

3 years ago

1.1.882

3 years ago

1.1.944

3 years ago

1.1.943

3 years ago

1.1.942

3 years ago

1.1.941

3 years ago

1.1.933

3 years ago

1.1.932

3 years ago

1.1.931

3 years ago

1.1.956

3 years ago

1.1.948

3 years ago

1.1.947

3 years ago

1.1.946

3 years ago

1.1.945

3 years ago

1.1.955

3 years ago

1.1.954

3 years ago

1.1.953

3 years ago

1.1.952

3 years ago

1.1.951

3 years ago

1.1.8681

3 years ago

1.1.8652

3 years ago

1.1.8651

3 years ago

1.1.8691

3 years ago

1.1.8581

3 years ago

1.1.858

3 years ago

1.1.857

3 years ago

1.1.867

3 years ago

1.1.866

3 years ago

1.1.865

3 years ago

1.1.864

3 years ago

1.1.863

3 years ago

1.1.862

3 years ago

1.1.861

3 years ago

1.1.860

3 years ago

1.1.856

3 years ago

1.1.855

3 years ago

1.1.869

3 years ago

1.1.868

3 years ago

1.1.8631

3 years ago

1.1.694

3 years ago

1.1.693

3 years ago

1.1.692

3 years ago

1.1.691

3 years ago

1.1.698

3 years ago

1.1.697

3 years ago

1.1.696

3 years ago

1.1.695

3 years ago

1.1.3999

3 years ago

1.1.8531

3 years ago

1.1.3881

3 years ago

1.1.419

3 years ago

1.1.418

3 years ago

1.1.417

3 years ago

1.1.661

3 years ago

1.1.74

3 years ago

1.1.73

3 years ago

1.1.72

3 years ago

1.1.8471

3 years ago

1.1.71

3 years ago

1.1.78

3 years ago

1.1.77

3 years ago

1.1.76

3 years ago

1.1.75

3 years ago

1.1.79

3 years ago

1.1.81

3 years ago

1.1.771

3 years ago

1.1.83

3 years ago

1.1.82

3 years ago

1.1.779

3 years ago

1.1.416

3 years ago

1.1.778

3 years ago

1.1.415

3 years ago

1.1.777

3 years ago

1.1.414

3 years ago

1.1.776

3 years ago

1.1.413

3 years ago

1.1.775

3 years ago

1.1.412

3 years ago

1.1.774

3 years ago

1.1.411

3 years ago

1.1.773

3 years ago

1.1.410

3 years ago

1.1.772

3 years ago

1.1.52

3 years ago

1.1.8451

3 years ago

1.1.51

3 years ago

1.1.56

3 years ago

1.1.55

3 years ago

1.1.54

3 years ago

1.1.53

3 years ago

1.1.59

3 years ago

1.1.58

3 years ago

1.1.57

3 years ago

1.1.63

3 years ago

1.1.8462

3 years ago

1.1.62

3 years ago

1.1.8461

3 years ago

1.1.61

3 years ago

1.1.67

3 years ago

1.1.66

3 years ago

1.1.65

3 years ago

1.1.64

3 years ago

1.1.69

3 years ago

1.1.68

3 years ago

1.1.849

3 years ago

1.1.848

3 years ago

1.1.847

3 years ago

1.1.846

3 years ago

1.1.3951

3 years ago

1.1.854

3 years ago

1.1.853

3 years ago

1.1.852

3 years ago

1.1.851

3 years ago

1.1.850

3 years ago

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3982

3 years ago

1.1.386

3 years ago

1.1.3983

3 years ago

1.1.385

3 years ago

1.1.384

3 years ago

1.1.3981

3 years ago

1.1.383

3 years ago

1.1.389

3 years ago

1.1.388

3 years ago

1.1.387

3 years ago

1.1.3993

3 years ago

1.1.3994

3 years ago

1.1.3991

3 years ago

1.1.3992

3 years ago

1.1.3997

3 years ago

1.1.3998

3 years ago

1.1.3995

3 years ago

1.1.3996

3 years ago

1.1.836

3 years ago

1.1.835

3 years ago

1.1.3961

3 years ago

1.1.3962

3 years ago

1.1.845

3 years ago

1.1.844

3 years ago

1.1.843

3 years ago

1.1.842

3 years ago

1.1.841

3 years ago

1.1.840

3 years ago

1.1.397

3 years ago

1.1.396

3 years ago

1.1.395

3 years ago

1.1.393

3 years ago

1.1.392

3 years ago

1.1.391

3 years ago

1.1.390

3 years ago

1.1.834

3 years ago

1.1.833

3 years ago

1.1.832

3 years ago

1.1.831

3 years ago

1.1.399

3 years ago

1.1.398

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.862

3 years ago

1.0.861

3 years ago

1.1.382

3 years ago

1.1.381

3 years ago

1.1.34

3 years ago

1.1.33

3 years ago

1.1.32

3 years ago

1.1.31

3 years ago

1.1.38

3 years ago

1.1.37

3 years ago

1.1.36

3 years ago

1.1.35

3 years ago

1.1.375

3 years ago

1.1.374

3 years ago

1.1.373

3 years ago

1.1.372

3 years ago

1.1.371

3 years ago

1.0.73

3 years ago

1.0.72

3 years ago

1.0.71

3 years ago

1.0.77

3 years ago

1.0.76

3 years ago

1.0.75

3 years ago

1.1.379

3 years ago

1.1.378

3 years ago

1.1.377

3 years ago

1.0.79

3 years ago

1.1.376

3 years ago

1.0.78

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.364

3 years ago

1.1.363

3 years ago

1.1.362

3 years ago

1.1.361

3 years ago

1.0.84

3 years ago

1.0.83

3 years ago

1.0.82

3 years ago

1.0.81

3 years ago

1.0.88

3 years ago

1.0.87

3 years ago

1.0.86

3 years ago

1.1.369

3 years ago

1.0.85

3 years ago

1.1.368

3 years ago

1.1.367

3 years ago

1.1.366

3 years ago

1.1.365

3 years ago

1.0.89

3 years ago

1.0.91

3 years ago

1.0.95

3 years ago

1.0.94

3 years ago

1.0.93

3 years ago

1.0.92

3 years ago

1.0.99

3 years ago

1.0.98

3 years ago

1.0.97

3 years ago

1.0.96

3 years ago

1.0.61

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago