Video.js: currentTime() does not work inside player.ready() in safari

Created on 27 Oct 2017  路  5Comments  路  Source: videojs/video.js

Description

currentTime() does not work inside player.ready() in safari

http://jsbin.com/lizarefopo/edit?html,output

Steps to reproduce

Explain in detail the exact steps necessary to reproduce the issue.

  1. try the jsbin in chrome (jumps 10s ahead)
  2. try it in safari (starts at 0s)

Results

Expected

Video should start at 10s

Actual

Video starts at 0s

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Video.js Example Embed</title>

  <link href="http://vjs.zencdn.net/6.2.8/video-js.css" rel="stylesheet">
  <script src="http://vjs.zencdn.net/6.2.8/video.js"></script>

</head>
<body>
  <h1>Video.js Example Embed</h1>

  <video id="my_video_1" class="video-js" muted controls preload="auto" width="640" height="268" 
  data-setup='{}'>
    <source src="http://vjs.zencdn.net/v/oceans.mp4" type='video/mp4'>
    <source src="http://vjs.zencdn.net/v/oceans.webm" type='video/webm'>
  </video>

  <script>
    var player = videojs('my_video_1').ready(function () {
      this.currentTime(10)
      this.play()
    })
  </script>

</body>
</html>
outdated

Most helpful comment

Still currentTime() not working in 7+ version. ..

All 5 comments

Yeah, this is because Safari is weird and you can't actually change the current time at least until loadedmetadata but sometimes even later like until canplay is fired.
Video.js should probably handle this better, though.

Tested on Chrome, Safari on iPhone. Both are not working.
Any suggestion how to work around it for now?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Still currentTime() not working in 7+ version. ..

@scottgrayson Have you found the solution to make it work in Safari and iOS devices?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kitsunde picture kitsunde  路  4Comments

aagiulian picture aagiulian  路  3Comments

uikoo9 picture uikoo9  路  4Comments

TheKassaK picture TheKassaK  路  3Comments

cshah123 picture cshah123  路  4Comments