I try to convert this html script to typescript in Ionic

Sorry to ask this thing but I can not change this html that access camera direct to html5 and can save the image but I can not convert because I am not an expert with ionic.
If someone can help me I appreciate because I would like to use when I generate a PWA, from Android and IOS I am using other one.

The source for HTML is this:

video id=“player” controls autoplay>
button id=“capture”>Capture
canvas id=“snapshot” width=320 height=240>

I remove the first < because there is a problem to show my source, sorry

I would like to access the camera without any plugin just html5.

Thank you in advance for my help
Regards,

Inside de Script:

var player = document.getElementById(‘player’);
var snapshotCanvas = document.getElementById(‘snapshot’);
var captureButton = document.getElementById(‘capture’);

var handleSuccess = function(stream) {
// Attach the video stream to the video element and autoplay.
player.srcObject = stream;
};

captureButton.addEventListener(‘click’, function() {
var context = snapshot.getContext(‘2d’);
// Draw the video frame to the canvas.
context.drawImage(player, 0, 0, snapshotCanvas.width,
snapshotCanvas.height);
});

navigator.mediaDevices.getUserMedia({video: true})
.then(handleSuccess);

image
Sorry when I send the program this site put the image direct not show my source
My full source is on image above

Sorry when I send the program this site put the image direct not show my source
My source is on image above

How to markdown code.

<html>tags work fine</html>
class Foo {
  bar() {
    soDoesJavaScript();
  }
}

tks, Robert Coie this is my hole html file that I want to convert this html script to typescript in Ionic

<video id="player" controls autoplay></video>
<button id="capture">Capture</button>
<canvas id="snapshot" width=320 height=240></canvas>
<script>
  var player = document.getElementById('player'); 
  var snapshotCanvas = document.getElementById('snapshot');
  var captureButton = document.getElementById('capture');

  var handleSuccess = function(stream) {
    // Attach the video stream to the video element and autoplay.
    player.srcObject = stream;
  };

  captureButton.addEventListener('click', function() {
    var context = snapshot.getContext('2d');
    // Draw the video frame to the canvas.
    context.drawImage(player, 0, 0, snapshotCanvas.width, 
        snapshotCanvas.height);
  });

  navigator.mediaDevices.getUserMedia({video: true})
      .then(handleSuccess);
</script>