I'm working on the Shopify website, using Ella theme. I have successfully embedded a product video into the theme's code, so it can be played in a pop-up modal window. Everything is fine except one problem - when the modal is closing the video continues playing in the background.
This is the modal I'm using in the product.liquid file:
<div class="modal fade halo_modal-custom" role="dialog">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<a data-dismiss="modal" class="close close-modal" title="{{ 'cart.ajax_cart.close' | t }}" href="javascript:void(0)">
{% include 'icon-close' %}
</a>
</div>
<div class="modal-body">
<div class="videoWrapper" id="my-player">
{% if product.description contains '/video' %}
{% assign src = product.description | split:'<video' | last | split:'</video>' | first %}
<video id="my_video_player" {{src}}> </video>
{% elsif product.description contains 'iframe' %}
{% assign src = product.description | split:'<iframe' | last | split:'</iframe>' | first %}
<iframe id="my_video_player" {{src}}> </iframe>
{% endif %}
</div>
</div>
</div>
</div>
</div>
I'm not experienced in programming. Can anyone help me with the solution?