Skip to content

Commit

Permalink
feat: add type markup property for video/audio
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Aug 5, 2023
1 parent 4063a53 commit 279c974
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ const addBody = ({ url, headers, html }) => {
if (isMime(contentType, 'image')) {
element = `<img src="${url}"></img>`
} else if (isMime(contentType, 'video')) {
element = `<video src="${url}"></video>`
element = `<video controls="" autoplay=""><source src="${url}" type="${contentType}"></source></video>`
} else if (isMime(contentType, 'audio')) {
element = `<audio src="${url}"></audio>`
element = `<audio controls="" autoplay=""><source src="${url}" type="${contentType}"></source></audio>`
} else if (mimeExtension(contentType) === 'json') {
element = `<pre>${html}</pre>`
}
Expand Down
8 changes: 6 additions & 2 deletions test/html/snapshots/index.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ Generated by [AVA](https://avajs.dev).
<meta property="og:site_name" content="audiovideoweb.com">␊
<link rel="canonical" href="http://websrvr90va.audiovideoweb.com/va90web25003/companions/Foundations%20of%20Rock/13.01.mp3">␊
</head>␊
<body><audio src="http://websrvr90va.audiovideoweb.com/va90web25003/companions/Foundations%20of%20Rock/13.01.mp3"></audio></body>␊
<body><audio controls="" autoplay="" name="media">␊
<source src="http://websrvr90va.audiovideoweb.com/va90web25003/companions/Foundations%20of%20Rock/13.01.mp3" type="audio/mp3">␊
</audio></body>␊
</html>`

## add video markup
Expand All @@ -103,7 +105,9 @@ Generated by [AVA](https://avajs.dev).
<meta property="og:site_name" content="sample-videos.com">␊
<link rel="canonical" href="https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4">␊
</head>␊
<body><video src="https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4"></video></body>␊
<body><video controls="" autoplay="" name="media">␊
<source src="https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4" type="video/mp4">␊
</video></body>␊
</html>`

## '`rewriteCssUrls` don't modify html markup
Expand Down
Binary file modified test/html/snapshots/index.js.snap
Binary file not shown.
8 changes: 6 additions & 2 deletions test/snapshots/index.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ Generated by [AVA](https://avajs.dev).
<meta name="date" content="{DATE}">␊
<link rel="canonical" href="https://audiodemos.github.io/vctk_set0/embedadapt_100sample.wav">␊
</head>␊
<body><audio src="https://audiodemos.github.io/vctk_set0/embedadapt_100sample.wav"></audio></body>␊
<body><audio controls="" autoplay="" name="media">␊
<source src="https://audiodemos.github.io/vctk_set0/embedadapt_100sample.wav" type="audio/wav">␊
</audio></body>␊
</html>`

## from image URL
Expand Down Expand Up @@ -45,7 +47,9 @@ Generated by [AVA](https://avajs.dev).
<meta name="date" content="{DATE}">␊
<link rel="canonical" href="http://techslides.com/demos/sample-videos/small.mp4">␊
</head>␊
<body><video src="http://techslides.com/demos/sample-videos/small.mp4"></video></body>␊
<body><video controls="" autoplay="" name="media">␊
<source src="http://techslides.com/demos/sample-videos/small.mp4" type="video/mp4">␊
</video></body>␊
</html>`

## from bad SSL URL
Expand Down
Binary file modified test/snapshots/index.js.snap
Binary file not shown.

0 comments on commit 279c974

Please sign in to comment.