Pavlov TV API: Difference between revisions

From Pavlov VR Wiki
Jump to navigation Jump to search
(Start page)
 
No edit summary
Line 38: Line 38:


''Ex. “MatchActive”: true or “MatchActive”: false''
''Ex. “MatchActive”: true or “MatchActive”: false''


RoundTime- Will return the active time into the round in seconds
RoundTime- Will return the active time into the round in seconds


''Ex. "RoundTime": 105''
''Ex. "RoundTime": 105''


Teams- Will return true/false if the there are teams in this match
Teams- Will return true/false if the there are teams in this match


''Ex. "Teams": true''
''Ex. "Teams": true''


RoundsLeft- Will return the maximum number of rounds left in the match
RoundsLeft- Will return the maximum number of rounds left in the match


''Ex. "RoundsLeft": 15''
''Ex. "RoundsLeft": 15''


Team0Score- Will return blue team’s score
Team0Score- Will return blue team’s score
Line 58: Line 66:


''"Team1Score": 2,''
''"Team1Score": 2,''


AttackingTeamId- Will return the ID of the currently attacking team 0-blue, 1- red
AttackingTeamId- Will return the ID of the currently attacking team 0-blue, 1- red


''Ex. "AttackingTeamId": 1''
''Ex. "AttackingTeamId": 1''


Team0Cash- Will return blue team’s collective cash  
Team0Cash- Will return blue team’s collective cash  
Line 68: Line 80:


''Ex. "Team0Cash": 2500, "Team1Cash": 2500''
''Ex. "Team0Cash": 2500, "Team1Cash": 2500''
MatchStatus.Team0 or MatchStatus.Team1


MatchStatus.Team0 or MatchStatus.Team1
'''MatchStatus.Team0 or MatchStatus.Team1'''


''Ex.in JS to fetch Team0 from MatchStatus''<blockquote>const teamZero = matchData.Team0  
''Ex.in JS to fetch Team0 from MatchStatus''<blockquote>const teamZero = matchData.Team0  


const teamOne = matchData.Team1</blockquote>These will give you an array of JSON style objects
const teamOne = matchData.Team1</blockquote>These will give you an array of JSON style objects

Revision as of 10:47, 3 December 2024

Pavlov TV has exposed endpoints to allow users to create their own UI interface for use in steaming software such as OBS, data-sets, or any other purpose of your choosing from Pavlov replays.

Enable the API

1. Ensure you have PavlovVR installed on steam and locate the GameUserSettings.ini file.

This file on windows machines will usually be found at [ %localappdata%\Pavlov\Saved\Config\Windows\GameUserSettings.ini ] You can paste this into your file explorer(without the brackets [] ) to open the file.

2. Go the the bottom portion of the [/Script/Pavlov.PavlovGameUserSettings] part of the file, ABOVE[ScalabilityGroups].

3. Add PavTVAPIPort=1234 onto the file at that location. 1234 is the port that will be used, if you know this port is in use already, please find another on your device that is not in use and list it here.

4. Run PavTV

Using OBS with your generated/written HTML file

1. Copy your HTML file path

2. Go to “Sources” and click the “+” button

3. Add browser source and create new (name it whatever)

4. Adjust Resolution of the source(recording size)

5. Paste in the HTML file path and click OK

The GET Endpoints

*If you are new to this, you are able to put any of these endpoint “links” into your browser or run curl requests and check that they are functional


MatchStatus

Ex.in JS to fetch this endpoint on port 1234 const response = await fetch('http://localhost:1234/MatchStatus'); const matchData = await response.json()

const response = await fetch('http://localhost:1234/MatchStatus'); const matchData = await response.json();

Elements in MatchStatus

MatchActive- Will return whether a match is currently ongoing or not

Ex. “MatchActive”: true or “MatchActive”: false


RoundTime- Will return the active time into the round in seconds

Ex. "RoundTime": 105


Teams- Will return true/false if the there are teams in this match

Ex. "Teams": true


RoundsLeft- Will return the maximum number of rounds left in the match

Ex. "RoundsLeft": 15


Team0Score- Will return blue team’s score

Team1Score- Will return red team’s score

Ex. "Team0Score": 1,

"Team1Score": 2,


AttackingTeamId- Will return the ID of the currently attacking team 0-blue, 1- red

Ex. "AttackingTeamId": 1


Team0Cash- Will return blue team’s collective cash

Team1Cash- Will return red team’s collective cash

Ex. "Team0Cash": 2500, "Team1Cash": 2500 MatchStatus.Team0 or MatchStatus.Team1

MatchStatus.Team0 or MatchStatus.Team1

Ex.in JS to fetch Team0 from MatchStatus

const teamZero = matchData.Team0 const teamOne = matchData.Team1

These will give you an array of JSON style objects