Commit Graph

4 Commits

Author SHA1 Message Date
hmuurine f58b32cae6
Unit tests for library (#156)
* add unit test coverage reports to gitignore

* add jest dependencies

* add jest config

* add Config unit tests

* add AFKController unit tests

* mock video codecs list

* test for PixelStreaming SettingsChangedEvent

* mock/unmock functions for RTCRtpReceiver

* mock WebSocket

* test for PixelStreaming.connect()

* unit test for disconnect

* unit tests for reconnect

* added eventemitter events in tests

* test that listStreamers is sent on WS connect

* mock RTCPeerConnection and RTCIceCandidate

* test webRtcConnected event

* test RTCPeerConnect close

* fixed variable name for consistency

* check for navigator.getGamepads before calling it

* mock addTransceiver, createAnswer, getTransceivers, setRemoteDescription

* test for receiving a connection offer

* add null checks for peerConnection since it might be null if connectiong closed

* mock addIceCandidate

* test for receiving ICE candidate message

* mock setLocalDescription, getStats

* test for statistics

* test webRtcDisconnected event

* mock RTCDataChannel and RTCDataChannelEvent

* test for dataChannelOpen event

* mock RTCTrackEvent

* mock MediaStream and MediaStreamTrack

* mock video element play()

* test playStream and playStreamRejected events

* mock video readyState

* mock WebRTC data channel send()

* test emitCommand

* test emitUIInteraction

* test emitConsoleCommand

* Jest mock for HTMLMediaElement.play()

* check boolean return value of all emit* commands

* test dataChannelClose event

* added TextEncoder and TextDecoder to Jest globals

* mock datachannel onmessage

* test UE -> browser data channel message

* clarified in test description that we are using a Response message

* extracted commonly used setup steps as util functions

* triggerSdpOffer -> triggerSdpOfferMessage for consistency

* run unit tests as a Github action

* Revert "break one of the tests to test the GH action"

This reverts commit 05f5742cf0.

* run tests only if files changed under Frontend/library

* added unit test run instructions to README.md
2023-03-17 12:41:05 +10:00
William Belcher 4fc43bcf29
Multi-streamer QOL improvements around stream switching and selection (#88)
* Set streamer selector on stream start

* Restart stream automatically one streamer selection change

* Only respect the `preferSFU` toggle if there's an SFU connected

* Only subscribe to the URL specified streamer if that streamer is connected
2023-02-13 12:25:58 +10:00
Luke Bermingham 61e82732a3
Convert frontend javascript to typescript and refactor. (#63)
* Refactor javascript frontend into a typescript library and a reference implementation.

* fixed restart stream

* fixed bug where the afk was still active after a reguler dissconnection

* added overlay for when the stream was loading

* added dissconect overlay that allows reconnection

* added comments for disconnection overlay

* replaced all bind methods with arrow functions to make code cleaner

* seperated auto webrtc connection from auto play with a new config paramater

* added the new QP icon

* added fully functional qp indicator

* removed redundant code and changed image restart icon to svg

* added the ability to toggle fullscreen and added logic

* added the ability to toggle settings and stats but need to clean up css and make icon images show

* fixed qp stat bug

* fixed bug with the dissconect action overlay and autoplay

* added icons for tooltips

* changed images to be served as base 64

* configured svg button in the index for fast loading

* moddifed styles in the settings and stats menu

* fixed matchviewport resolution

* added favicons and fixed matchviewportresolution

* refactored VideoPlayerController to StreamController

* upgraded the logger to be more usefull

* remove hard-coded signalling server address from the frontend

* seperated playing audio from playing video in webrtcplayer controller and fixed logger bug for ff and ios

* reworked sound and video

* added a fix for ios making svg icons invisible when having filteres aplyed to them

* added qol change where the settings pannel closes when clicking restart stream

* turned off autoplay

* logged unknown dc messages

* logged unknown dc messages moved log before error

* add support for sending back a pong message to the signalling server on response to a ping message

* Bug fixed multitouch zooming the page

* ensure that the max width of the panel wrap can never exceed the max width of the viewport

* fix the force turn button so that it appears off to the right of the label

* Added support for handling websocket messages sent as binary.

* added a feature that looks for turn servers if turn is forced. 

* reworked turn to dissconect if forced and there are no servers

* add support for overriding the disconnection message in the webrtcplayercontroller

* Improve grammar on the error message when there is no TURN server

* prevent the disconnect message from incorrectly appearing as undefined

* added message to closing the websocket

* consolidated commands and ui descriptors

* moved message methods to SendMessageController

* integrated input rework

* added datachannel sender

* refactored mouse/keyboard input

* refactored normalise and quanatize

* refactored pointerlock functionality

* refactored touch controller

* fixed resizing bugs

* fixed player resolution and mouse movment bugs

* Adding AFK setting to settings panel

* Add support for signalling server url passed as /?ss= as url parameter.

* Fix video fill display option

* Added programmatic way to create togglable settings

* Added programmatic surface to construct settings flags

* Added FillWindow as a new flagged setting in the new settings.

* Move control scheme setting into new settings config.

* Added buttons programmatically instead of in html

* Added numeric settings for min/max qp

* Added a new type for creating numeric settings: `SettingNumber`

* Added safe codepath if KeyboardEvent.keyCode is deprecated in the browser.

* Moved WebRTC settings to new programmable approach

* Created settings panel that can be constructed programmatically

* Moved all overlay construction into Overlays.ts

* Removed `showStats` boolean that was now unused.

* Added programmatic construction of video qp indicator.

* Fullscreen icon not constructed programmatically, including icons.

* Settings icon now programmatically constructed

* Stats Icon is now programmatically constructed.

* Moved all icons to a controls element that is programmatically constructed.

* Programmatically construct latency test element.

* Create stats panel programmatically

* Programmatically construct uiFeature element and playerUI root element of Pixel Streaming application

* Remove dependency on events lib

* Added italic headings to stat panel headings and changed tooltip on stats panel to say 'information'

* Allow browser to receive offers - UE5 compatibility

* Hooked up new signalling protocol that can be extended to support custom signalling messages

* Fix bug in signalling protocol handler calls. rename 'browser send answer' to browser send offer' to reflect what it actually does.

* Add SFU support. Also removed usages of console.xxx for logging and replaced with use of the Logger.

* Fix all linter errors and most warnings.

* Fix: Config control scheme wasn't being updated with the value parsed from the URL

* Remove control scheme from config. It is no handled directly from the settings panel and the URL

* Enable PS to embed properly

* Moving signalling server in setting text that can be accessed and set programmatically

* Moved construction of signalling server url into library

* Merge SFU work into signalling url changes by creating a construct signalling url function

* Create Epic Games reference implementation.

* Moved all config options from members to be settings which can set in the UI or URL

* Remove reference to any type and fix remaining linter errors.

* Refactor normalize and quantize to be called coordinate converter.

* Refactored AFK logic to be AFK Controller

* Removed UiController and moved logic into video player

* Fix security vulnerabilities in implementations. Remove unused packages.

* Fix spelling errors.

* Add ability to handle default mouse scheme from an offer. Also fixed some bugs in the settings that prevented onChange callbacks getting called.

* Add stresstester to implementation. This unveiled some points where we were using document.getElementByID(xxx) which isn't useful for when there are > 1 players

* Add login page

* Rename libfrontend to pixelstreamingfrontend

* Add copyright notice

* Fix double connections. Remove logging from websocket onerror as the error event doesn't contain any information

* Fix body filling more than the screen size on iOS

* Add toggle for light and dark mode. defaults to system preference

* Fix mic not working

* Fix light mode

* Fix backspace not working

* Adding jss support

* Fix webpack compilation

* Fixed css in js to handle camel case names for styles

* Remove tag level css rules that may leak into someone elses application

* Added light mode, fixed css, fixed to US spelling of color, fixed loading overlay.

* Changing stress test default values

* Remove esbuild

* Added fix for vh100 creating scroll of iOS devices

* Cleanup websocket disconnect message to contain reason only if one is valid

* Add webpack devserve to contain dist dir

* Fix backspace not working

* Fixing use mic option that was not usable locally

* Cleaning up package.json files

* Updating readme for release

* Move the new typescript frontend into a /Frontend directory.

* Remove old frontend files and update implementation to build into webserver directory

* Renamed index to player.html to match existing conventions in Cirrus

* Added script to install frontend if not built and also an option to force it to build with --build

* Cleaned up indentation and trailing whitespace

* Updated setup_frontend.bat to install npm packages too

* Updated bash setup scripts to build frontend if missing or directed

* Revised arg handling to match rest of the bash scripts

* Added a disclaimer if the frontend build is skipped

* Added --build description to --help display

* Removed uncessary includes from tsconfig

* Remove superfluous package-lock.json in root.

* Added prettier and performed whitespace pass on the library.

* Add missing typescript dependency.

Co-authored-by: hmuurine <hmuurine@users.noreply.github.com>
Signed-off-by: Luke Bermingham <1215582+lukehb@users.noreply.github.com>

* Update Frontend/library/package.json

* Add missing typescripe and webpack dependencies.

Co-authored-by: hmuurine <hmuurine@users.noreply.github.com>
Signed-off-by: Luke Bermingham <1215582+lukehb@users.noreply.github.com>

* Add ability to set preferred codec during negotiation

* Fix missing stats in stats panel

* Set update selector based on what was negotiated once video starts

* Fix sfu not working due to fmtp line reordering

* Update default codec for use with ios

* Fix signalling server not connecting if frontend is hosted on anything other than port 80

* Fix locked mouse 'MouseDown' events using the wrong coordinate location

* Fix: On Windows always use our bundled NodeJS to build the frontend.

* Adding SetEnv.exe tool that is used on Windows to temporarily modify path during frontend install.

* Linux: Add npm to the path temporarily when running `setup_frontend.sh`

* Remove preferred codec from text parameters as it's now an option parameter

---------

Signed-off-by: Luke Bermingham <1215582+lukehb@users.noreply.github.com>
Co-authored-by: Adrian Zahra <adrian@tensorworks.com.au>
Co-authored-by: Daniel Holden <daniel@tensorworks.com.au>
Co-authored-by: David MacPherson <david@tensorworks.com.au>
Co-authored-by: William Belcher <william.belcher@hotmail.com>
Co-authored-by: Michael Stopa <michael.stopa@xa.epicgames.com>
Co-authored-by: hmuurine <hmuurine@users.noreply.github.com>
Co-authored-by: William Belcher <william.belcher@xa.epicgames.com>
2023-02-07 11:34:44 +10:00
Nick Pace b0ede1b29a
Added gitignore 2022-06-22 10:29:44 +10:00