<style>.modal {background-color: rgba(0, 0, 0, .7);}.fade:not(.show) {opacity: 1;}.modal-content {background-image: unset;background-color: unset;background-clip: unset;position: relative;-webkit-background-clip: padding-box;background-clip: padding-box;border-radius: 15px;outline: 0;color: white;background-color: transparent;}.modal-header {color: white;text-shadow: black 0.1em 0.1em 0.2em;padding-bottom: 0;border: none;}.modal-footer{border-top: none;}.modal-backdrop {display: none;}.modal-body {padding: 0;margin-bottom: 5%;}#video-container{top: 47vw;left: 51%;width: 77%;transform: translate(-50%, -50%);position: absolute;}.video-timer {margin: auto;top: 80%;left: 50%;width: 80%;transform: translate(-50%, -50%);position: absolute;font-size: 16px;color: #FFFFFF;display: none;}#video_overlays{position: absolute;background-color: rgba(0, 0, 0, 0.5);z-index: 2;left: 0;right: 0;top: 0;bottom: 0;display: -webkit-flex;display: flex;align-items: center;justify-content: center;}#myProgress {margin: auto;border-radius: 10px;top: 75vw;left: 51%;width: 77%;transform: translate(-50%, -50%);position: absolute;}.bar-base {width: 100%;height: 15px;background-image:url('{{ asset('images/loadbar_bg.png') }}');background-size: 100%;background-repeat: no-repeat;border-radius: 10px;position: relative;}#bar {width: 0%;height: 15px;background-image:url('{{ asset('images/loadbar.png') }}');background-size: 100% 80%;background-repeat: no-repeat;border-radius: 10px;position: absolute;left: 4px;}.video-frame {min-height: 260px;}.frame{width: 95%}.close{background-color: transparent;top: 18%;right: 7%;z-index: 100;position: absolute;border: none;width: 8% !important;}#videoComfirmBtn{width: 60%;position: absolute;bottom: 4vw;left: 21%;}</style><script>function gtag_action_watchVideo(result){gtag('event', 'video watch', {'event_category': '{{ custom_data }}','event_label': result});}</script><script>function reflash(){pauseVid();console.log('test');window.location.href = "{{ path('game_pre_checkAgent', {'language': app.request.locale}) }}";}function videoView() {//pauseVid();vid = document.getElementById("myVideo");if (remaingTime >= {{ video_time }}) {let countdown = vid.duration - vid.currentTime;$.post("{{ path('api_resign_mission', {'language': app.request.locale}) }}", {"jwt": jwt},function (data, status) {if (data.result == 'success') {//$("#modal_message_success").html(data.message);//$('#myModal_success').modal('show');//refresh();}else if (data.result == 'fail') {if (data.action == 'retry') {$("#modal_message").html(data.message);$('#myModal_message').modal('show');}else if (data.action == 'login') {window.location.href = "{{ path('game_pre_checkAgent', {'language': app.request.locale}) }}";}}});}}$(function () {$(document).on('hide.bs.modal', '.modal', function () {if (typeof vid !== 'undefined') {closeVideoDiv();}});});let is_embeded = false;let starttime = 0;let remaingTime = 15;let refreshIntervalId = null;function playVid() {if (!vid.paused) {vid.pause();} else {vid.play();//gtag_action_StartVideo(videoURL);}}function pauseVid() {vid.pause();}function closeVideoDiv() {if (!vid.paused) {vid.pause();}}function embedVideo() {gtag_action_watchVideo('success');is_embeded = false;starttime = 0;remaingTime = 0;refreshIntervalId = null;if (is_embeded === false) {videoURL = '{{ asset('/video/~video_link~') }}';videoembed = '<div id="video_overlays"><img src="{{ asset('images/play_button.png') }}" style="width: 35%;"/></div><video id="myVideo" width="100%" height="auto" webkit-playsinline="true" playsinline="true" > <source src="{{ asset('video/' ~ video_link) }}" type="video/mp4">Your browser does not support HTML5 video. </video>';document.getElementById('video-container').innerHTML = videoembed;document.getElementById("myVideo").controls = true;document.getElementById("myVideo").load();vid = document.getElementById("myVideo");is_embeded = true;document.getElementById("timer-div").innerHTML = "{{ 'video.countdown' | trans }}" + {{ video_time }};document.getElementById("bar").style.width = "0%";$("#videoComfirmBtn").attr('disabled', true);document.getElementById("videoComfirmBtn").style.visibility = "hidden";$("#close").attr('disabled', false);document.getElementById("close").style.visibility = "visible";let timer = null;function updateTimeLable() {remaingTime = Math.floor(remaingTime + 1);if (remaingTime < {{ video_time }}) {document.getElementById("timer-div").innerHTML = "{{ 'video.countdown' | trans }}" + remaingTime;document.getElementById("bar").style.width = ((remaingTime / {{ video_time }})*98) + "%";}else {if (remaingTime == {{ video_time }}){document.getElementById("timer-div").innerHTML = "{{ 'video.countdown' | trans }}" + remaingTime;document.getElementById("bar").style.width = 98 + "%";}$("#videoComfirmBtn").attr('disabled', false);document.getElementById("videoComfirmBtn").style.display = "inline-block";document.getElementById("videoComfirmBtn").style.visibility = "visible";videoView();$("#close").attr('disabled', true);document.getElementById("close").style.visibility = "hidden";clearInterval(refreshIntervalId);}}vid.addEventListener("pause", function () {clearInterval(refreshIntervalId);$('#video_overlays').show();});vid.addEventListener("ended", function () {if (remaingTime >= 28) {$("#videoComfirmBtn").attr('disabled', false);document.getElementById("videoComfirmBtn").style.display = "inline-block";}});vid.addEventListener("play", function () {if (starttime == 0) {refreshIntervalId = setInterval(updateTimeLable, 1000);}else {refreshIntervalId = setInterval(updateTimeLable, 1000);}$('#video_overlays').hide();});}var myModal_mission_start = $('#myModal_video').offset().top;var headerOffset = 0; // Adjust this value based on your header height$('html, body').animate({scrollTop: myModal_mission_start - headerOffset}, 500);}</script><div class="modal fade" id="myModal_video" role="dialog" data-backdrop="static"><div class="modal-dialog"><div class="modal-content" style="box-shadow:none;border:none;"><div class="modal-header"><button type="button" class="close" data-dismiss="modal"><img id="close" src="{{ asset('images/close_btn.png') }}" class="close_img" alt="close" align="right"></button></div><div class="modal-body" style="margin-top:10%"><div onclick="playVid()"><img src="{{ asset('images/resign_message.png') }}" class="frame video-frame"/><div id="video-container"></div>{# <div class="dialog-desc"> {{ 'mission.video' | trans }} </div> #}<div id="myProgress"><div id="bar"></div><div class='bar-base'></div></div><div id="timer-div" class="video-timer"></div></div><div id="videoComfirmBtn" onclick='reflash()'><img src="{{ asset('images/done_btn.png') }}" style="width: 65%;"data-dismiss="modal" class="modal-footer-btn video-btn"></div></div></div></div></div>