How to get the currentTime for each videos in videojs using an array of videos from database in laravel

I have been trying to process an array of videos in blade template with video js but so far no look. What I want to do is, when a user pause one of the videos, save the time he played the videos to start from this time next time the user reloads the page. Right now I can get the currentTime but it only works for one video, also I managed to pause the actual playing videos when other video is being played, it does show the playing time on the console, but it only works for one videos. Any help would be really appreciated. Than you!

This is the code where I display the array of videos

@foreach($lessons as $lesson)
                                                    <div class="d-flex justify-content-between align-items-center">
                                                        <div class="d-flex align-items-center">
                                                            <!-- Video button -->

                                                                <video
                                                                    id="my-video"
                                                                    class="video-js"
                                                                    controls
                                                                    preload="auto"
                                                                    width="640"
                                                                    height="264"
                                                                    poster="{{asset('assets/images/courses/4by3/01.jpg')}}"
                                                                    data-setup="{}"
                                                                >
                                                                    <source src="{{asset('storage/video/'.$lesson->link)}}" type="video/mp4" />

                                                                </video>
                                                                <hr> <!-- Divider -->


                                                            <!-- Content -->
                                                            <div class="ms-3">
                                                                <a href="#" class="d-inline-block text-truncate mb-0 h6 fw-normal w-100px w-sm-200px w-md-400px"> {{$lesson->title}}</a>
                                                                <ul class="nav nav-divider small mb-0">
                                                                    <li class="nav-item">Dire: {{$lesson->playing_time}}</li>

                                                                </ul>
                                                            </div>
                                                        </div>

                                                    </div>
                                                    <hr> <!-- Divider -->
                                                    @endforeach

And this is the script where I try to process the videos, right now I’m just focused on showing the time on the console, sending it to the database is not an issue.

<script>
    var player = videojs('my-video');
    window.addEventListener('load', function(event) {
        document.querySelectorAll("#my-video video").forEach((video) => {
            video.onplay = function(event) {
                event.preventDefault();
                document.querySelectorAll("#my-video video").forEach((playing) => {
                    if (video === playing)
                    {
                        playing.play();
                    }
                    else
                    {
                        playing.pause();
                        var currentTime = player.currentTime();
                        console.log(currentTime);
                    }

                });
            }
        });
    });

</script>

Thank you very much for your support.