Skip to main content

HTML Page Hosting vyking-apparel

This is a webpage that host's Vyking's vyking-apparel custom element which provides the virtual try-on experience. It can be a minimal page that is then controlled from the hosting application by running appropriate javascript code.

Below is a simple example page (which can be referenced by the hosting application with this url: https://sneaker-window.vyking.io/vyking-apparel/1/examples/in-app-simple-camera.html). Points of relevance when running in-app (see Virtual Try-On Custom HTML Element for other details) are:

  • self.HTMLVykingApparelElement.useVykWebViewCamera needs to be defined and set to true to configure vyking-apparel to get its camera feed from the hosting application.
  • No config or key attributes need to be specified. This is handled by the hosting application.
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<title>Vyking Apparel Camera</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">

<link rel="icon" type="image/png" href="../assets/images/favicon.png">

<script>
self.HTMLVykingApparelElement = self.HTMLVykingApparelElement || {}
self.HTMLVykingApparelElement.useVykWebViewCamera = true
</script>

<script type="module" src="https://sneaker-window.vyking.io/vyking-apparel/1/vyking-apparel.js"></script>

<style>
html,
body {
height: 100%;
margin: 0px;
padding: 0px;
}

#vyking-apparel {
border: 0px;
height: 100%;
margin: 0px;
padding: 0px;
width: 100%;
}
</style>
</head>

<body>
<vyking-apparel id="vyking-apparel" share autocamera onerror="alert(`Error: ${event.message}`)">
<canvas slot="canvas">Virtual Try On</canvas>
</vyking-apparel>
</body>

</html>