-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp-context.jsx
159 lines (146 loc) · 3.64 KB
/
app-context.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import React, { Component, createContext } from "react";
/**
* Mocked Assets
*/
import rise from "assets/music/rise.mp3";
import fantastic from "assets/music/fantastic.mp3";
import legendsNeverDie from "assets/music/legends-never-die.mp3";
import shortLegendsNeverDie from "assets/music/short-legends-never-die.mp3";
export const appContext = createContext();
class appProvider extends Component {
constructor(props) {
super(props);
/**
* state
*/
this.state = {
player: {
/**
* Audio Context
*/
threadInUse: "worker", // 'main' or 'worker'
audioContext: null,
analyser: null,
gainNode: null,
currentSource: null,
bufferLength: null,
duration: 0,
tracks: [
{
name: "Small Piece of music LND",
artist: "League of Legends",
url: shortLegendsNeverDie,
},
{
name: "Legends Never Die",
artist: "League of Legends",
url: legendsNeverDie,
},
{
name: "Rise",
artist: "League of Legends",
url: rise,
},
{
name: "Fantastic - Cinematic Sound",
artist: "AudioJungle",
url: fantastic,
},
],
musicIndex: 0,
playing: false,
javascriptNode: null,
firstPlay: true,
audioContextCreatedTime: 0,
audioLoadOffsetTime: 0,
audioCurrentTime: 0,
updatedVolume: false,
isLoadingSong: false,
isLoadingFullSong: false,
canLoadFullSong: true,
playingFullMusic: false,
audioStreamData: null,
trackerEnabled: false, // @NOTE: tracker disabled until solve the thing of re-read stream data and not re-set the position of tracker
/**
* Canvas Context
*/
canvas: null,
canvasContext: null,
canvasWidth: null,
canvasHeight: null,
canvasScaleCoef: null,
canvasCx: null,
canvasCy: null,
canvasCoord: null,
canvasFirstDraw: true,
canvasResized: false,
/**
* Framer Context
*/
framerTransformScale: false,
framerCountTicks: 360,
framerFrequencyData: [],
framerTickSize: 10,
framerPI: 360,
framerIndex: 0,
framerLoadingAngle: 0,
framerMaxTickSize: null,
framerTicks: null,
/**
* Scene Context
*/
scenePadding: 120,
sceneMinSize: 740,
sceneOptimiseHeight: 982,
sceneInProcess: false,
sceneRadius: 250,
/**
* Tracker Context
*/
trackerInnerDelta: 20,
trackerLineWidth: 7,
trackerPrevAngle: 0.5,
trackerAngle: 0,
trackerAnimationCount: 10,
trackerPressButton: false,
trackerAnimatedInProgress: false,
trackerAnimateId: null,
trackerR: 226.5,
/**
* Controls Context
*/
timeControl: {
textContent: "00:00",
},
/**
* Misc
*/
initialFixedTicks: false,
hasStreamSupport: !!window.fetch && !!window.ReadableStream,
},
};
/**
* functions
*/
this.myFunction = this.myFunction.bind(this);
}
myFunction() {}
/**
* React Render
*/
render() {
return (
<appContext.Provider
value={{
/**
* Player
*/
player: this.state.player,
}}
>
{this.props.children}
</appContext.Provider>
);
}
}
export default appProvider;