Lifecycle hook
This commit is contained in:
		
							parent
							
								
									55e389ba61
								
							
						
					
					
						commit
						95005327a3
					
				
					 2 changed files with 13 additions and 7 deletions
				
			
		|  | @ -39,8 +39,6 @@ const props = withDefaults(defineProps<{ | |||
| }>(), { | ||||
| }); | ||||
| 
 | ||||
| new Vlitejs('#player'); | ||||
| 
 | ||||
| const audioEl = $ref<HTMLAudioElement | null>(); | ||||
| let hide = $ref(true); | ||||
| 
 | ||||
|  | @ -49,7 +47,10 @@ function volumechange() { | |||
| } | ||||
| 
 | ||||
| onMounted(() => { | ||||
| 	if (audioEl) audioEl.volume = ColdDeviceStorage.get('mediaVolume'); | ||||
| 	if (audioEl) { | ||||
| 		audioEl.volume = ColdDeviceStorage.get('mediaVolume'); | ||||
| 		new Vlitejs('#player'); | ||||
| 	} | ||||
| }); | ||||
| </script> | ||||
| 
 | ||||
|  |  | |||
|  | @ -26,7 +26,7 @@ | |||
| </template> | ||||
| 
 | ||||
| <script lang="ts" setup> | ||||
| import { ref } from 'vue'; | ||||
| import { ref, onMounted } from 'vue'; | ||||
| import * as misskey from 'misskey-js'; | ||||
| import 'vlitejs/dist/vlite.css'; | ||||
| import Vlitejs from 'vlitejs'; | ||||
|  | @ -37,11 +37,16 @@ const props = defineProps<{ | |||
| 	video: misskey.entities.DriveFile; | ||||
| }>(); | ||||
| 
 | ||||
| Vlitejs.registerPlugin('pip', VlitejsPip); | ||||
| const videoEl = $ref<HTMLVideoElement | null>(); | ||||
| 
 | ||||
| onMounted(() => { | ||||
| 	if (videoEl) { | ||||
| 		Vlitejs.registerPlugin('pip', VlitejsPip); | ||||
| 		new Vlitejs('#player', { | ||||
| 			plugins: ['pip'], | ||||
| 		}); | ||||
| 	} | ||||
| }); | ||||
| 
 | ||||
| const hide = ref((defaultStore.state.nsfw === 'force') ? true : props.video.isSensitive && (defaultStore.state.nsfw !== 'ignore')); | ||||
| </script> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue