Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ 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">
  <script src="https://app.singular.live/libs/singularoverlay/1.0.0/singularoverlay.js"></script>
</head>
<body>
  <div class="video-wrapper">
    <video id="VideoPlayer" class="video-js" controls preload="auto" width="640" height="360" data-setup="{}">
      <source src="https://wixmp-3cd9cad51439e55d79e6d6d6.wixmp.com/TestVideo1_4.mp4" type='video/mp4'>
    </video>
  </div>
  <script src="https://vjs.zencdn.net/7.3.0/video.js"></script>
</body>
              
            
!

CSS

              
                html,
body {
  font-family: "Lato";
  height: 95%;
  width: 95%;
}
body {
  padding: 1em 2em;
  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: block;
  margin: 0.2em 0 0.5em 0;
  color: black;
  font-weight: 100;
  font-size: 15px;
}

.video-wrapper {
  position: relative;
  height: 100%;
}

.video-wrapper #my-video {
  position: relative;
  z-index: 1;
  width: 90%;
  margin: 3em auto;
}

.video-wrapper #SingularOverlay {
  position: absolute;
  z-index: 2;
  width: 100%;
  height: 100%;
}

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

              
            
!

JS

              
                	var options = {
		class: 'iFrameClass',
		endpoint: 'https://app.singular.live',
		interactive: true,
		syncGraphics: false,
		showPreloader: false,
		interactive: true,
		aspect: ''
	}
	var vjs = videojs('VideoPlayer');
	  
	var singularDomElement = document.createElement('div');
	singularDomElement.setAttribute("id", "SingularOverlay");
	vjs.el().appendChild(singularDomElement);
	  
	var overlay = SingularOverlay('#SingularOverlay', options, (params) => {
		// callback code goes here
		console.log("Singular Overlay Init - Success");
	});
	  
	/*
			// List of all HTML5 events (various uses).
			vjs.Html5.Events = 'loadstart,suspend,abort,error,emptied,stalled,loadedmetadata,loadeddata,canplay,canplaythrough,playing,waiting,seeking,seeked,ended,durationchange,timeupdate,progress,play,pause,ratechange,volumechange'.split(',');
	*/
	/*
			mapping overlay SDK functions
			videoPlaying()			// playing
			videoPaused()			// pause
			videoBuffering()		// waiting
			videoStopped()	
			videoFinished()			// ended
			videoSeeking(time)		// seeking
			videoSeeked()			// seeked
			videoTime(time)			// timeupdate
			videoMetadata(object)	// loadedmetadata
			videoMuted()		
			videoUnmuted()
			videoVolume(value)		// volumechange
			videoAdStart()
			videoAdFinished()
			videoAdSkip()
			videoSegment(time)
	*/
	// define callbacks supported by video.js
	// video is playing
	vjs.on("play", function(e) {
		overlay.videoPlaying();
	});
	// video is paused
	vjs.on("pause", function(e) {
		overlay.videoPaused();
	});
	// video is waiting, buffering
	vjs.on("waiting", function(e) {
		overlay.videoBuffering();
	});
	// video has ended
	vjs.on("ended", function(e) {
		overlay.videoFinished();
	});
	// video seeking
	vjs.on("seeking", function(e) {
		overlay.videoSeeking(vjs.currentTime());
	});
	// video seeked
	vjs.on("seeked", function(e) {
		overlay.videoSeeked();
	});
	// video metadata loaded
	vjs.on("loadedmetadata", function(e) {
		overlay.videoMetadata();
	});
	// video volume changed
	vjs.on("volumechange", function(e) {
		overlay.videoVolume(vjs.volume());
	});
	// video time changed
	vjs.on("timeupdate", function(e) {
		overlay.videoTime(vjs.currentTime());
	});
	overlay.setContent({
		compToken: '6lvfuMr7yFPY2NXbZ4qnZV'
	}, (params) => {
		// called when content finished loading
		console.log("Singular Overlay Content Loaded - Success");
	});
	overlay.addListener('message', function(params) {
		// MESSAGE RECEIVED FROM OVERLAY SDK (GRAPHIC EVENTS):
		console.log("OVERLAY RECEIVED MESSAGE: ", params);
		switch (params) {
			case "btnPlay":
				vjs.player().play();
				break;
			case "btnPause":
				vjs.player().pause();
				break;
			case "btnContinue":
				vjs.player().play();
				break;
		}
	});

              
            
!
999px

Console