v1.0.4
Improve screen sharing hook
This release improves the screen sharing API with a more flexible useDisplayMedia hook and a more convenient integration flow for media elements.
Features
useDeviceList— improved the hook for reading available media devices fromnavigator.mediaDevices.enumerateDevices(). It now returns the full device list together with pre-groupedaudioInputs,audioOutputs, andvideoInputs, supports automatic initial loading, exposes manualupdateandtriggeractions, and listens to the nativedevicechangeevent to keep the list in sync.useDeviceList— makes it easier to work with media device selection flows by separating microphones, speakers, and cameras out of the box, while still preserving access to the rawdevicesarray when full control is needed.useMediaStream— improved the hook for managing a livemediaDevices.getUserMedia()stream. It now supports both target-element and ref-based usage, exposesstart,stop,restart, andapplycontrols, tracksactiveandloadingstates, automatically attaches the stream to a media element, and providesonStart,onStop, andonErrorcallbacks.useDisplayMedia— improved the hook for working withnavigator.mediaDevices.getDisplayMedia(). It now supports both target-element and ref-based usage, making it easier to attach a shared screen stream directly to a video element.useDisplayMedia— updated the API to support defaultconstraintsthrough options and per-call constraints throughstart(constraints), which makes screen and audio sharing scenarios more flexible.useDisplayMedia— addedonStartandonStopcallbacks for reacting to sharing lifecycle events without extra effects.useDisplayMedia— improved stream lifecycle handling so the hook automatically binds the stream to the media element, tracksactivestate, and correctly stops sharing when the underlying media tracks end.