File tree Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change 165165 mp4boxfile .flush ()
166166 maybeEndOfStream ()
167167 // Start playback after all data is processed
168- videoElement .play ().catch ((e ) => console .error (' Play error:' , e))
168+ if (! isControlled) {
169+ togglePlay ()
170+ }
169171 return
170172 }
171173
217219 }
218220
219221 function togglePlay () {
220- if (videoElement .value ? .paused ) {
221- videoElement .value
222+ if (! videoElement) {
223+ return
224+ }
225+
226+ if (videoElement? .paused ) {
227+ videoElement
222228 ? .play ()
223229 .then (() => {
224230 isPaused = false
225231 })
226232 .catch ((e ) => console .error (' Play error:' , e))
227233 } else {
228- videoElement . value ? .pause ()
234+ videoElement? .pause ()
229235 isPaused = true
230236 }
231237 }
Original file line number Diff line number Diff line change @@ -173,8 +173,10 @@ function downloadChunk() {
173173 if (nextRangeStart >= totalFileSize) {
174174 mp4boxfile .flush ()
175175 maybeEndOfStream ()
176- // Start playback after all data is processed
177- videoElement .value ? .play ().catch ((e ) => console .error (' Play error:' , e))
176+ if (! props .isControlled ) {
177+ // If controlled, then it will play when clicked.
178+ togglePlay ()
179+ }
178180 return
179181 }
180182
@@ -224,6 +226,10 @@ function maybeEndOfStream() {
224226}
225227
226228function togglePlay () {
229+ if (! videoElement .value ) {
230+ return
231+ }
232+
227233 if (videoElement .value ? .paused ) {
228234 videoElement .value
229235 ? .play ()
You can’t perform that action at this time.
0 commit comments