react-native-webview-video
Version:
react-native-webview-video is a React Native library that provides a Video component that renders media content such as videos with custom controls for react-native and react-native-web. Support Youtube and Vimeo.
37 lines (36 loc) • 1.24 kB
JavaScript
export function localJSHTML(videoId, videoType = "video") {
return `<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Media player</title>
<meta charset="utf-8">
<meta name="author" content="santran686@gmail.com">
<meta name="author" content="chainplatform.net">
<style>
video,
audio {
display: none;
width: 100%;
}
video {
height: auto;
}
</style>
</head>
<body>
<video id="videoplayer" controls controlsList="nodownload" oncontextmenu="return false;" style="display: none;"></video>
<audio id="audioplayer" controls controlsList="nodownload" oncontextmenu="return false;" style="display: none;"></audio>
<script>
document.getElementById('audioplayer').style.display = "none";
document.getElementById('videoplayer').style.display = "none";
let mediaplayer = document.getElementById('audioplayer');
if ("${videoType}" == "video") {
mediaplayer = document.getElementById('videoplayer');
}
mediaplayer.src = "${videoId}";
mediaplayer.style.display = "block";
</script>
</body>
</html>`
}