chore(frontend/MkMediaVideo): loop and autoplay silent videos (#12392)
This commit is contained in:
		 Acid Chicken (硫酸鶏)
					Acid Chicken (硫酸鶏)
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							c9503da8f8
						
					
				
				
					commit
					d60f645d1d
				
			| @@ -37,6 +37,7 @@ import * as Misskey from 'misskey-js'; | ||||
| import bytes from '@/filters/bytes.js'; | ||||
| import { defaultStore } from '@/store.js'; | ||||
| import { i18n } from '@/i18n.js'; | ||||
| import hasAudio from '@/scripts/media-has-audio.js'; | ||||
|  | ||||
| const props = defineProps<{ | ||||
| 	video: Misskey.entities.DriveFile; | ||||
| @@ -49,6 +50,12 @@ const videoEl = shallowRef<HTMLVideoElement>(); | ||||
| watch(videoEl, () => { | ||||
| 	if (videoEl.value) { | ||||
| 		videoEl.value.volume = 0.3; | ||||
| 		hasAudio(videoEl.value).then(had => { | ||||
| 			if (!had) { | ||||
| 				videoEl.value.loop = videoEl.value.muted = true; | ||||
| 				videoEl.value.play(); | ||||
| 			} | ||||
| 		}); | ||||
| 	} | ||||
| }); | ||||
| </script> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user