Commit 1668e97
authored
fix: make MediaPlayerFactory SSR-safe to prevent "window is not defined" error (Dash-Industry-Forum#4929)
Wrap the auto-creation logic in a browser environment check to allow
dash.js to be imported in SSR environments like Next.js without throwing
a "window is not defined" error.
The module-level code that accesses window APIs (addEventListener,
setInterval, etc.) is now only executed when running in a browser context.
Fixes Dash-Industry-Forum#47281 parent 20b8441 commit 1668e97
1 file changed
+21
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
107 | 106 | | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
112 | 110 | | |
113 | | - | |
114 | | - | |
115 | | - | |
| 111 | + | |
| 112 | + | |
116 | 113 | | |
117 | 114 | | |
118 | | - | |
119 | 115 | | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
| 116 | + | |
124 | 117 | | |
| 118 | + | |
125 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
126 | 133 | | |
127 | | - | |
128 | | - | |
| 134 | + | |
129 | 135 | | |
130 | | - | |
131 | | - | |
132 | 136 | | |
133 | 137 | | |
134 | 138 | | |
| |||
0 commit comments