Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <head>
  <link href="https://vjs.zencdn.net/7.3.0/video-js.css" rel="stylesheet">
</head>
<body>
  <div> 
    <h1>Singular VOD Example using Graphics SDK
    </h1>
    <h2>Use video.js events to control Singular graphics
    </h2>
    <p>
      Contact your Singular Support Team for a copy of the composition. <br>
      Visit our <a href="https://www.singular.live">Singular.live</a> web page!
    </p>
  </div>
  <div class="video-wrapper">
    <video id="VideoPlayer" class="video-js" controls preload="auto" width="640px" height="360px" data-setup="{}">
      <source src="https://wixmp-3cd9cad51439e55d79e6d6d6.wixmp.com/TestVideo1_4.mp4" type='video/mp4'>
    </video>
<iframe id="SingularOverlay" src="https://app.singular.live/singularplayer/client"></iframe>  </div>
  <script src="https://vjs.zencdn.net/7.3.0/video.js">
  </script>
  <script src="https://app.singular.live/libs/singulargraphics/1.0.0/singulargraphics.js">
  </script>
</body>

              
            
!

CSS

              
                html,
body {
  font-family: "Lato";
}
body {
  background-color: #f4f4f6;
  color: #515477;
  overflow-x: hidden;
}

h1 {
  text-align: center;
  margin: 0 0 0 0;
  color: black;
  font-weight: 100;
  font-size: 25px;
}

h2 {
  text-align: center;
  margin: 0.5em 0 0.9em 0;
  color: black;
  font-weight: 100;
  font-size: 20px;
}

p {
  text-align: center;
  margin: 0.2em 0 0.5em 0;
  color: black;
  font-weight: 100;
  font-size: 15px;
}

.video-wrapper {
  position: relative;
  width: 640px;
  height: 360px;
  margin: 3em auto;
}

#SingularOverlay {
  position: absolute;
  top: 0px;
  z-index: 2;
  width: 640px;
  height: 360px;
  border: 0px;
  pointer-events: none;
}

.vjs-big-play-button {
  z-index: 3;
}
.vjs-control-bar {
  z-index: 4;
}

              
            
!

JS

              
                // this is the composition I want to load
let composition = "https://assets.singular.live/7072b13f9e20b98034f48d6202400ff9/jsons/39qtXwoOSVMqAxInnMaZHl.json";

// create player object from iframe 'SingularPlayer'
// let player = SingularPlayer("SingularOverlay");
let player = SingularGraphics("SingularOverlay");

let sequencer;

player.loadComposition(composition, isSuccess => {
  if (isSuccess.success) {
    console.log("LoadComposition finished.");
  } else {
    console.log("LoadComposition failed.");
    return;
  }
  
  // this is the sequencer object of the composition
  sequencer = player.getSequencer();
  
  // now assign the sequence
  sequencer.setPayload(GetSequence());
  
  // start at the beginning
  sequencer.seek(0);
});

// get the video player
let vjs = videojs('VideoPlayer');

// initialize video.js 
vjs.on("play", function(e) {
  console.log("play");
  if (sequencer) sequencer.play();
});
// video is paused
vjs.on("pause", function(e) {
  console.log("pause");
  if (sequencer) sequencer.stop();
});
// video is waiting, buffering
vjs.on("waiting", function(e) {
  console.log("waiting");
  if (sequencer) sequencer.stop();
});
// video has ended
vjs.on("ended", function(e) {
  console.log("ended");
  if (sequencer) sequencer.stop();
});
// video seeking
vjs.on("seeking", function(e) {
  console.log("seeking");
  if (sequencer) sequencer.seek(vjs.currentTime());
});

function GetSequence() {
  return {
		"7d2d4799-ac5f-43ef-812c-63dbcc9541fc": [{
			"beginTime": 1,
			"endTime": 6,
			"controlNode": {
				"payload": {
					"Image": "https://assets.singular.live/7072b13f9e20b98034f48d6202400ff9/svgs/57VdHBnRTPNEU4yirlLfKm_w880h146.svg",
					"Image Size": "100",
					"Title": "Welcome to the Singular Reframe Demo!"
				}
			}
		}],
		"2ed116aa-bb56-49a5-adc4-37f7654312a8": [{
			"beginTime": 2,
			"endTime": 5,
			"controlNode": {
				"payload": {
					"Text": "On Stream!"
				}
			}
		}, {
			"beginTime": 5,
			"endTime": 9,
			"controlNode": {
				"payload": {
					"Text": "On Demand"
				}
			}
		}, {
			"beginTime": 10,
			"endTime": 13,
			"controlNode": {
				"payload": {
					"Text": "On Device"
				}
			}
		}],
		"78d77507-e90f-4a29-be86-099b7bd541dd": [{
			"beginTime": 2,
			"endTime": 13,
			"controlNode": {
				"payload": {
					"Text": "Singular.live"
				}
			}
		}],
		"dce1e90c-1d8d-4854-87e0-da8eed153105": [{
			"beginTime": 7,
			"endTime": 10,
			"controlNode": {
				"payload": {
					"Image": "https://assets.singular.live/7072b13f9e20b98034f48d6202400ff9/svgs/57VdHBnRTPNEU4yirlLfKm_w880h146.svg",
					"Image Size": "100",
					"Title": "A panel on the left size"
				}
			}
		}, {
			"beginTime": 11,
			"endTime": 14,
			"controlNode": {
				"payload": {
					"Image": "https://static.wixstatic.com/media/0b65f2_aa8eb4641aed406abd72f6c0272b9cac~mv2.jpeg/v1/fill/w_306,h_201/rcs.webp",
					"Image Size": "90",
					"Title": "Now with a different title"
				}
			}
		}]
	}
}
              
            
!
999px

Console