npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@pw2016/pw-player-communicator

v2.0.0

Published

Tool to achieve the easiest way of communication with the video/chat frames

Downloads

47

Readme

pw-player-communicator

Tool to achieve the easiest way of communication with the video/chat frames.

Installation

0. Pre-requisites

You should have the two iframes already created on the DOM with the the attributes name="video-frame" and name="chat-frame" respectively. The video-frame needs the attribute allow="camera;microphone;autoplay;fullscreen" in order to allow the user to activate his camera in private and his camera and microphone in VIP.

1. Include the library:

You can do this inyecting directly to window:

<script src="path/to/lib.js"></script>
<script src="path/to/your.js"></script>

Or if you're working with NPM / ES6:

npm install --save @pw2016/pw-player-communicator
...
import { Communicator } from "@pw2016/pw-player-communicator";

Maybe you are interested in the Integration examples.

2. Instance the communicator with the sessionToken in options object:

If you are inyecting into window:

var communicator = new PWPlayer.Communicator({
  sessionToken: sessionToken
});

Or if you're working with NPM / ES6:

const communicator = new Communicator({
    sessionToken: "sessionToken"
});

Events

How to listen

communicator.on("videoPlay", function(){
  console.log("video play in tester");
});

Available events

Video events

  • videoPlay()
  • videoStop()
  • videoOffline()
  • videoError()

Chat events

  • chatMessage(object: { nick, message })
  • roomModeUpdate(string: roomMode)
  • VIPRequestStatusUpdate(string: status)

Common events

  • disconnected(string: reason)
  • userCamStatus(string: status)

Methods

Video

  • setVolume(float 0 ... 1: volume)
  • setMuted(boolean: muted)
  • destroyVideo()
  • activateUserCam()
  • deactivateUserCam()
  • playVideo()

Chat

  • sendMessage(string: message)

  • goToGroupChat()

  • requestVIP()

  • You have one example of the tester in the folder: examples/tester

Known issues

Autoplay Audio not started

Some browser doesn't allow autoplay with sound. You can fix this with AudioContext and adding the permission autoplay in the iframe

You have one example in the folder: examples/detectnoaudio

Not video because Low Power Mode in iPhone

If you have the low power mode on in your iPhone, you can´t see the video because the phone is trying to keep the battery.

You can fix this with checking if you got the "videoPlay" event in the communicator after few seconds.

You have one example in the folder: examples/lowpowermodeiphone

Integration examples

Currently we have an example of integration using Next.js using the appRouter.

Check out the Next.js integration example.

Changes on 2.0.0

New events

New event to expose the user cam status:

  • userCamStatus(string: status)

Removed methods

The next methods are no longer available. Sending tips or toys now should be done throug api request.

  • sendTip(int: amount)
  • sendToy(int: amount)