Changed around line 1
+ const video = document.getElementById('main-video');
+ const playPauseBtn = document.getElementById('play-pause');
+ const fullscreenBtn = document.getElementById('fullscreen');
+ const seekSlider = document.getElementById('seek-slider');
+
+ let isZoomed = false;
+ let startX, startY, translateX = 0, translateY = 0;
+
+ // Play/Pause functionality
+ playPauseBtn.addEventListener('click', () => {
+ if (video.paused) {
+ video.play();
+ playPauseBtn.textContent = '⏸️';
+ } else {
+ video.pause();
+ playPauseBtn.textContent = '▶️';
+ }
+ });
+
+ // Fullscreen functionality
+ fullscreenBtn.addEventListener('click', () => {
+ if (!document.fullscreenElement) {
+ video.requestFullscreen();
+ } else {
+ document.exitFullscreen();
+ }
+ });
+
+ // Seek functionality
+ seekSlider.addEventListener('input', () => {
+ const seekTime = video.duration * (seekSlider.value / 100);
+ video.currentTime = seekTime;
+ });
+
+ video.addEventListener('timeupdate', () => {
+ const value = (100 / video.duration) * video.currentTime;
+ seekSlider.value = value;
+ });
+
+ // Double tap to skip
+ let lastTap = 0;
+ video.addEventListener('touchend', (e) => {
+ const currentTime = new Date().getTime();
+ const tapLength = currentTime - lastTap;
+
+ if (tapLength < 300 && tapLength > 0) {
+ const skipTime = e.touches[0].clientX < window.innerWidth / 2 ? -10 : 10;
+ video.currentTime += skipTime;
+ }
+
+ lastTap = currentTime;
+ });
+
+ // Handle orientation changes
+ window.addEventListener('orientationchange', () => {
+ if (isZoomed) {
+ resetZoom();
+ }
+ });
+
+ // Zoom and pan functionality
+ video.addEventListener('touchstart', (e) => {
+ if (e.touches.length === 2) {
+ isZoomed = true;
+ startX = (e.touches[0].pageX + e.touches[1].pageX) / 2;
+ startY = (e.touches[0].pageY + e.touches[1].pageY) / 2;
+ }
+ });
+
+ video.addEventListener('touchmove', (e) => {
+ if (isZoomed && e.touches.length === 2) {
+ const scale = Math.hypot(
+ e.touches[0].pageX - e.touches[1].pageX,
+ e.touches[0].pageY - e.touches[1].pageY
+ ) / Math.hypot(
+ e.touches[0].pageX - e.touches[1].pageX,
+ e.touches[0].pageY - e.touches[1].pageY
+ );
+
+ const currentX = (e.touches[0].pageX + e.touches[1].pageX) / 2;
+ const currentY = (e.touches[0].pageY + e.touches[1].pageY) / 2;
+
+ translateX += currentX - startX;
+ translateY += currentY - startY;
+
+ video.style.transform = `scale(${scale}) translate(${translateX}px, ${translateY}px)`;
+ video.style.transformOrigin = 'center center';
+ }
+ });
+
+ video.addEventListener('touchend', () => {
+ if (isZoomed) {
+ isZoomed = false;
+ }
+ });
+
+ function resetZoom() {
+ video.style.transform = 'none';
+ translateX = 0;
+ translateY = 0;
+ }