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>(); | const audioEl = $ref<HTMLAudioElement | null>(); | ||||||
| let hide = $ref(true); | let hide = $ref(true); | ||||||
| 
 | 
 | ||||||
|  | @ -49,7 +47,10 @@ function volumechange() { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| onMounted(() => { | onMounted(() => { | ||||||
| 	if (audioEl) audioEl.volume = ColdDeviceStorage.get('mediaVolume'); | 	if (audioEl) { | ||||||
|  | 		audioEl.volume = ColdDeviceStorage.get('mediaVolume'); | ||||||
|  | 		new Vlitejs('#player'); | ||||||
|  | 	} | ||||||
| }); | }); | ||||||
| </script> | </script> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -26,7 +26,7 @@ | ||||||
| </template> | </template> | ||||||
| 
 | 
 | ||||||
| <script lang="ts" setup> | <script lang="ts" setup> | ||||||
| import { ref } from 'vue'; | import { ref, onMounted } from 'vue'; | ||||||
| import * as misskey from 'misskey-js'; | import * as misskey from 'misskey-js'; | ||||||
| import 'vlitejs/dist/vlite.css'; | import 'vlitejs/dist/vlite.css'; | ||||||
| import Vlitejs from 'vlitejs'; | import Vlitejs from 'vlitejs'; | ||||||
|  | @ -37,10 +37,15 @@ const props = defineProps<{ | ||||||
| 	video: misskey.entities.DriveFile; | 	video: misskey.entities.DriveFile; | ||||||
| }>(); | }>(); | ||||||
| 
 | 
 | ||||||
| Vlitejs.registerPlugin('pip', VlitejsPip); | const videoEl = $ref<HTMLVideoElement | null>(); | ||||||
| 
 | 
 | ||||||
| new Vlitejs('#player', { | onMounted(() => { | ||||||
| 	plugins: ['pip'], | 	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')); | const hide = ref((defaultStore.state.nsfw === 'force') ? true : props.video.isSensitive && (defaultStore.state.nsfw !== 'ignore')); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue