mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
feat(core): add vimeo media host and html/react components (#1667)
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
'use client';
|
||||
|
||||
import type { MediaEngineHost } from '@videojs/core';
|
||||
import type { RefCallback } from 'react';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
export function useAttachIframe<T extends HTMLIFrameElement>(media: MediaEngineHost): RefCallback<T> {
|
||||
return useCallback(
|
||||
(element: T | null) => {
|
||||
if (element) media.attach?.(element);
|
||||
else media.detach?.();
|
||||
return () => media.detach?.();
|
||||
},
|
||||
[media]
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user