mirror of
				https://github.com/TeamPiped/Piped.git
				synced 2024-08-14 23:57:27 +00:00 
			
		
		
		
	add watch progress bar
This commit is contained in:
		
							parent
							
								
									cf24fd5208
								
							
						
					
					
						commit
						005a938261
					
				
					 2 changed files with 20 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -10,13 +10,24 @@
 | 
			
		|||
                },
 | 
			
		||||
            }"
 | 
			
		||||
        >
 | 
			
		||||
            <img
 | 
			
		||||
                class="w-full aspect-video"
 | 
			
		||||
                :src="item.thumbnail"
 | 
			
		||||
                :alt="item.title"
 | 
			
		||||
                :class="{ 'shorts-img': item.isShort }"
 | 
			
		||||
                loading="lazy"
 | 
			
		||||
            />
 | 
			
		||||
            <div class="w-full">
 | 
			
		||||
                <img
 | 
			
		||||
                    class="w-full aspect-video"
 | 
			
		||||
                    :src="item.thumbnail"
 | 
			
		||||
                    :alt="item.title"
 | 
			
		||||
                    :class="{ 'shorts-img': item.isShort }"
 | 
			
		||||
                    loading="lazy"
 | 
			
		||||
                />
 | 
			
		||||
                <!-- progress bar -->
 | 
			
		||||
                <div class="relative w-full h-1">
 | 
			
		||||
                    <div
 | 
			
		||||
                        class="absolute bottom-0 left-0 h-1 bg-red-600"
 | 
			
		||||
                        v-if="item.watched && item.duration > 0"
 | 
			
		||||
                        :style="{ width: `clamp(0%, ${(item.currentTime / item.duration) * 100}%, 100%` }"
 | 
			
		||||
                    />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
 | 
			
		||||
            <div class="relative text-sm">
 | 
			
		||||
                <span
 | 
			
		||||
                    class="thumbnail-overlay thumbnail-right"
 | 
			
		||||
| 
						 | 
				
			
			@ -148,6 +159,7 @@ export default {
 | 
			
		|||
        };
 | 
			
		||||
    },
 | 
			
		||||
    mounted() {
 | 
			
		||||
        this.updateWatched([this.item]);
 | 
			
		||||
        this.shouldShowVideo();
 | 
			
		||||
    },
 | 
			
		||||
    methods: {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -213,6 +213,7 @@ const mixin = {
 | 
			
		|||
                    request.onsuccess = function (event) {
 | 
			
		||||
                        if (event.target.result) {
 | 
			
		||||
                            video.watched = true;
 | 
			
		||||
                            video.currentTime = event.target.result.currentTime;
 | 
			
		||||
                        }
 | 
			
		||||
                    };
 | 
			
		||||
                });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue