ដាក់ Responsive HTML5 Mp4 វីដេអូ
ស្វាគមន៍សារជាថ្មី នៅក្នុងអត្ថបទមុនខ្ញុំបានលើកយកគន្លឹះក្នុងការ Embed វីដេអូជាលក្ខណៈ Iframe ចំណែកក្នុងអត្ថបទនេះវិញខ្ញុំនឹងបង្ហាញអ្នកទាំងអស់គ្នាពីរបៀបក្នុងការដាក់វីដេអូជា File .mp4 ម្ដង។ ១.ចូលទៅកាន់ Theme => Edit HTML រួចចម្លងកូដខាងក្រោមដាក់ពីខាងលើ </head>
<style type="text/css">
#video-player{position:relative;overflow:hidden;width:100%;height:100%;border-radius:5px}
.video-container{border:4px solid #ff0000}
.video-responsive{position:relative;overflow:hidden;width:100%;height:100%;padding-top:56.25%;background-color:rgb(0,0,0)}
.video-responsive video{position:absolute;top:0;left:0;width:100%;height:100%}
</style>២.ចម្លងកូដខាងក្រោមដាក់ពីខាងលើ </body> បន្ទាប់មកចុច Icon Save រួចចាកចេញពីផ្ទាំង Edit HTML <script type="text/javascript">
$('#video-player').each(function () {
let $this = $(this),
zeroIndex = 0,
buildVideo = "";
buildVideo += '<div class="video-container">';
buildVideo += '<div class="video-responsive">';
buildVideo += '<video class="video-mp4" width="100%" height="100%" controls playsinline webkit-playsinline>';
buildVideo += '<source src="' + sourceFile[zeroIndex] + '" type="video/mp4">';
buildVideo += '</video>';
buildVideo += '</div></div>';
$this.html(buildVideo);
});
</script>៣.ចម្លងកូដខាងក្រោមដាក់ក្នុង Blog Post ដោយប្ដូរទៅជា HTML view <div id="video-player"></div>
<script>
let sourceFile = ["https://storage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"];
</script>៤.ផ្លាស់ប្ដូរ Link Video .mp4 ខាងលើរួចចុចពាក្យ Publish ជាការស្រេច៕
Comments
Post a Comment