@codeda/flashphoner
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

@codeda/flashphoner

Flashphoner implementation for Angular

Installation

Using npm:

$ npm install @codeda/flashphoner

Using yarn:

$ yarn add @codeda/flashphoner

Usage

  1. Init FlashphonerModule:

@NgModule({
  imports: [
    ...,
    FlashphonerModule.forRoot({
      session: {
        urlServer: ${flashphonerServerUrl}
      }
    })
  ]
})
export class AppModule {}
  1. Create/play stream:
import { FlashphonerService } from '@codeda/flashphoner';

@Component(...)
export class MyComponent {

  constructor(flashphonerService: FlashphonerService) {
    // Create stream
    flashphonerService
      .createStream({
        name: ${streamName},
        display: ${someHTMLElement},
        constraints: [MediaStreamConstraints](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints)
      })
      .subscribe(stream => console.log(stream));

    // Play stream
    flashphonerService
      .playStream({
        name: ${streamName},
        display: ${someHTMLElement}
      })
      .subscribe(stream => console.log(stream));
  }

}

Note

  1. Requires Flashphoner WebSDK.
  2. For proper stream playing in iOS you should pass extra params to FlashphonerModule.forRoot method:
FlashphonerModule.forRoot({
  session: {
    flashphoner: {
      flashMediaProviderSwfLocation: ${your path to media-provider.swf},
      receiverLocation: ${your path to WSReceiver2.js},
      decoderLocation: ${your path to video-worker2.js}
    },
    urlServer: ${flashphonerServerUrl}
  }
})

And before calling flashphonerService.createStream use this code:

if (Flashphoner.getMediaProviders()[0] === 'WSPlayer') {
  Flashphoner.playFirstSound();
} else if (
  Browser.isSafariWebRTC() ||
  Flashphoner.getMediaProviders()[0] === 'MSE'
) {
  Flashphoner.playFirstVideo(options.display);
}

Also serve preloader.mp4 at url path /dependencies/preloader.mp4.

utils.js - contains Browser; media-provider.swf WSReceiver2.js video-worker2.js

Package Sidebar

Install

npm i @codeda/flashphoner

Weekly Downloads

12

Version

0.0.1

License

MIT

Unpacked Size

217 kB

Total Files

65

Last publish

Collaborators

  • looffee