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

ray-streaming-extra-ue4

v1.6.5

Published

RayStreaming SDK for Web

Downloads

4

Readme

ray-streaming-extra-ue4

RayStreaming SDK for Web

Guides

Quick start
import { Launcher } from 'ray-streaming-extra-ue4'

// NOTE: provided by the operating environment
const appId = 'xxxxxxxxxxxxxxxxxxx'
const address = 'http://xxx.xxx.xxx.xxx:xxxx'

new Launcher({ address, appId }).automata()
Manual
import { Client, Connection } from 'ray-streaming-extra-ue4'

// 1. bootstrap app by use Client instance
const client = new Client('TARGET_ENVIRONMENT_ADDRESS')
// ...
client
  .getSessionInfo()
  .then((res) => res.data)
  .then(({ token, signaling }) => {
    // NOTE: obtain token, signaling
  })
// NOTE: start app
client.start({ appId: 'THE_APP_WHICH_WANT_TO_RUN', token })
// NOTE: POLLING request
client.status(appId, token).then((res) => {
  if (res.data.status === 'running') {
    // NOTE: use res.data.coturns as ICE server config˝
  }
})

// 2. setup Connection
const connection = new Connection(
  `${signaling}/clientWebsocket/${token}`,
  iceConfig, // NOTE: obtain above
)
connection.event.receivedVideo.on((media) => {
  // NOTE: received media stream, set to any video element
})

// 3. attach listener
connection.attachListener(video)
API reference
Connection

Manage the Signaling and PeerConnection connection with node machine

new Connection(url, iceServers[, iceTransportPolicy])

connection.emitUIInteraction(msg)

  • msg <string>

Send UI interaction message to remote application

connection.emitUIInteraction(JSON.stringify({ eventName: 'A' })).then((result) => {
  if (result) {
    console.log('execute success') // NOTE: only promise send to appliction
  }
})

connection.destory()

Close all connect, off event listener

Player

Provide the container to play the remote stream,

new Player(hostElement[, onPlay[, loadingBgImage[, voicedAtPlay])
  • hostElement <HTMLElement> any block element with fixed size
  • onPlay <() => void> invoke when video play
  • loadingBgImage <string> customize background loading image in app's loading stage
  • voicedAtPlay <boolean> remove muted attribute when play if set true Default: true

player.resizePlayer()

Resize player style to fill host element if host element size is smaller than player or resize player style to actual size

player.showTextOverlay(text)

  • text <string>

Show prompt with specify text and mask video stream

player.showLoadingText(msg)

  • msg <string>

show message on loading element, append loading overlay element to player overlay element at first time

player.destory()

Remove created elementsh

Launcher

Automate start-up application by the HTTP request, setup Player and Connection instance, then attach listener and Instantiate Virtual Control after DataChannel open

new Launcher(option).automata([hostElement])
  • hostElement <HTMLElement> any block element with fixed size

  • option

| Field | Type | Description | | ---------------- | ----------------------------------- | --------------------------------------------------- | | appId | string | App ID | | token | string | room secret | | bitrate | number(optional) | append x-google-max-bitrate in creact offer | | minBitrate | number(optional) | x-google-min-bitrate(same as bitrate field) | | startBitrate | number(optional) | x-google-start-bitrate(same as bitrate field) | | virtualComponent | VirtualControlDisplayType(optional) | 1: display all;2:display fullscreen only;3:hide all |

Caveat

  • Need to initialize Player after WeixinJSBridgeReady event fired if use in WeChat web-view
if (navigator.userAgent.includes('miniProgram') || navigator.userAgent.includes('MicroMessenger')) {
  document.addEventListener('WeixinJSBridgeReady', () => {
    // initialize here
  })
}
  • If you use with cjs or esm module system, need to provide process.env.NODE_NEV at runtime