@ashetm/ng-mediastream
v12.0.1
Published
``@ashetm/ng-mediastream`` is a library that simplify manipulation of API ``MediaStream``.
Downloads
36
Maintainers
Readme
@ashetm/ng-mediastream
@ashetm/ng-mediastream
is a library that simplify manipulation of API MediaStream
.
It works with Angular 11 and above
Install
You can install it with npm:
npm install @ashetm/ng-mediastream
Import
You only need to import MediastreamModule
.
...
import { MediastreamModule } from '@ashetm/ng-mediastream';
...
@NgModule({
...
imports: [
...
MediastreamModule,
...
]
...
})
export class AppModule { }
API
@ashetm/ng-mediastream
exposes the following:
Modules
MediastreamModule
, that needs to import in order to use the library
Services
MediastreamService
MediastreamService
is a service concern all about MediaStream
API.
And for methods, there is the following:
getCameraDevices()
returnsPromise<MediaDeviceInfo[]>
with camera device list of typeMediaDeviceInfo[]
.getDevices()
returnsPromise<MediaDeviceInfo[]>
with all device list of typeMediaDeviceInfo[]
.getMicrophoneDevices()
returnsPromise<MediaDeviceInfo[]>
with microphone device list of typeMediaDeviceInfo[]
.hasCameraDevices()
returnsPromise<boolean>
boolean
value if has at least 1 camera devise.hasMicrophoneDevices()
returnsPromise<boolean>
boolean
value if has at least 1 microphone devise.requestCamera(constraints?: MediaTrackConstraints)
returnsPromise<MediastreamCameraService>
that contain instance ofMediastreamCameraService
(See below), it has 1 optional argument:
constraints
of typeMediaTrackConstraints
a configuration for camera.
requestCameraAndMicrophone(constraints?: Partial<Record<'audio' | 'video', MediaTrackConstraints>>)
returnsPromise<MediastreamCameraService>
that contain instance ofMediastreamCameraService
(See below), it has 1 optional argument:
constraints
of typePartial<Record<'audio' | 'video', MediaTrackConstraints>>
a configuration for bot camera and microphone.
requestMicrophone(constraints?: MediaTrackConstraints)
returnsPromise<MediastreamMicrophoneService>
that contain instance ofMediastreamMicrophoneService
(See below), it has 1 optional argument:
constraints
of typeMediaTrackConstraints
a configuration for microphone.
MediastreamCameraService
MediastreamCameraService
is a service concern all about MediaStream
API of camera.
currentMediaDevice$
isObservable<MediaDeviceInfo>
, it emitsMediaDeviceInfo
value of current media camera device information.mediastream$
isObservable<MediaStream>
, it emitsMediaStream
value of media stream information.mediastreamConstraints
isboolean | MediaTrackConstraints
concerning camera configuration value.
For methods, there is the following:
disableCamera()
returnsvoid
, it disables the current camera device.enableCamera()
returnsvoid
, it enables the current camera device.toggleCamera()
returnsvoid
, it disables/enables the current camera device.updateCameraDevice(device: MediaDeviceInfo & Record<'kind', 'videoinput'>)
returnsvoid
, it updates the current camera device with the first argumentdevice: MediaDeviceInfo & Record<'kind', 'videoinput'>
.
MediastreamCameraMicrophoneService
MediastreamCameraMicrophoneService
is a service concern all about MediaStream
API of both camera and microphone at the same time.
currentCameraMediaDevice$
isObservable<MediaDeviceInfo>
, it emitsMediaDeviceInfo
value of current media camera device information.currentMicrophoneMediaDevice$
isObservable<MediaDeviceInfo>
, it emitsMediaDeviceInfo
value of current media microphone device information.mediastream$
isObservable<MediaStream>
, it emitsMediaStream
value of media stream information.mediastreamCameraConstraints
isboolean | MediaTrackConstraints
concerning camera configuration value.mediastreamMicrophoneConstraints
isboolean | MediaTrackConstraints
concerning microphone configuration value.
For methods, there is the following:
disableCamera()
returnsvoid
, it disables the current camera device.disableMicrophone()
returnsvoid
, it disables the current microphone device.enableCamera()
returnsvoid
, it enables the current camera device.enableMicrophone()
returnsvoid
, it enables the current microphone device.toggleCamera()
returnsvoid
, it disables/enables the current camera device.toggleMicrophone()
returnsvoid
, it disables/enables the current microphone device.updateCameraDevice(device: MediaDeviceInfo & Record<'kind', 'videoinput'>)
returnsvoid
, it updates the current camera device with the first argumentdevice: MediaDeviceInfo & Record<'kind', 'videoinput'>
.updateMicrophoneDevice(device: MediaDeviceInfo & Record<'kind', 'audioinput'>)
returnsvoid
, it updates the current microphone device with the first argumentdevice: MediaDeviceInfo & Record<'kind', 'audioinput'>
.
MediastreamMicrophoneService
MediastreamMicrophoneService
is a service concern all about MediaStream
API of microphone.
currentMediaDevice$
isObservable<MediaDeviceInfo>
, it emitsMediaDeviceInfo
value of current media microphone device information.mediastream$
isObservable<MediaStream>
, it emitsMediaStream
value of media stream information.mediastreamConstraints
isboolean | MediaTrackConstraints
concerning microphone configuration value.
For methods, there is the following:
disableMicrophone()
returnsvoid
, it disables the current microphone device.enableMicrophone()
returnsvoid
, it enables the current microphone device.toggleMicrophone()
returnsvoid
, it disables/enables the current microphone device.updateMicrophoneDevice(device: MediaDeviceInfo & Record<'kind', 'audioinput'>)
returnsvoid
, it updates the current microphone device with the first argumentdevice: MediaDeviceInfo & Record<'kind', 'audioinput'>
.
Issue
LOOKING FOR MAINTAINER OR IF THERE IS AN ISSUE OR ANY IDEA TO ADD. PLEASE CREATE ISSUE IN GITHUB REPOSITORY.