react-chromecast
Version:
A abstraction of cast lib to react.js
56 lines • 1.81 kB
TypeScript
import CastReceiver from "../interfaces/CastReceiver";
interface Props {
/**
* @param initialize_media_player - is media_receiver id
*
* if you pass auto_initialize as true you should pass this
*
* you should pass media_receiver id or 'DEFAULT_MEDIA_RECEIVER_APP_ID' to use default media receiver
*/
initialize_media_player?: string;
/**
* @param auto_initialize - you can use this to auto initialize cast media player when castReceiver was define
*
* you not need to pass nothing to this if you go initialize by yourself
*/
auto_initialize?: boolean;
}
interface Cast {
/**
* Function to initialize cast player before connect to chromecast
*
* This function should wait for castReceiver
*
* @param media_player - you should pass media_receiver id or 'DEFAULT_MEDIA_RECEIVER_APP_ID' to use default media receiver
*
* Example:
* ```jsx
* const cast = useCast()
* useEffect(() => {
* if(cast.castReceiver){
* cast.initializeCast('DEFAULT_MEDIA_RECEIVER_APP_ID')
* }
* }, [cast.castReceiver])
* ```
*/
initializeCast?: (media_player: string) => void;
/**
* Function to connect and disconnect client to chromecast
*/
handleConnection: () => Promise<any>;
/**
* castReceiver object, from cast_receiver google lib
*/
castReceiver?: CastReceiver;
/**
* castSender object, from cast_sender google lib
*/
castSender?: any;
/**
* this inidicate if client is connected with chromecast or not
*/
isConnect: boolean;
}
declare function useCast(props?: Props): Cast;
export default useCast;
//# sourceMappingURL=useCast.d.ts.map