Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recodedData duration less than player.record().getDuration in safari #597

Open
tonynguyenit18 opened this issue Aug 4, 2021 · 2 comments
Labels
needs-update safari-desktop Safari macOS browser issues

Comments

@tonynguyenit18
Copy link

tonynguyenit18 commented Aug 4, 2021

Description

on finishRecord event, I convert player.recordedData to a url to play in a video tag (or any video player or download it to local machine). But the video has duration is less than player.record().getDuration

Steps to reproduce

  • Record video as normal
  • handle onFinish event
import "./style.less"
import "video.js/dist/video-js.css"
import "webrtc-adapter"
import "videojs-record/dist/css/videojs.record.css"
import "videojs-record/dist/videojs.record.js"
mport RecordRTC from "recordrtc"
import videojs, { VideoJsPlayerOptions } from "video.js"
....
  const videoJsPlayerOptions = {
      controls: false,
      fluid: false,
      plugins: {
        record: {
          audio: true,
          video: true,
          debug: true,
          timeSlice: 1000,
          maxLength: 90,
          videoMimeType: "video/mp4"
        }
      }
    }
   player = videojs(recordVideoEl.current, videoJsPlayerOptions, () => {
      // print version information at startup
      const version_info = `Using video.js ${videojs.VERSION} with videojs-record ${videojs.getPluginVersion(
        "record"
      )} and recordrtc ${RecordRTC.version}`
      videojs.log(version_info)
    })

   player.on("timestamp", function () {
      const currentTime = Math.floor(player.record().getCurrentTime()) // This time is same as player.record().getDuration ==> good
    })

   player.on("finishRecord", async () => {
      console.log("player.duration time", player.record().getDuration()) // this is 17.123 for example
      const mp4Url = window.URL.createObjectURL(player.recordedData)
      setMp4Url(mp4Url)
    })
  • play the video
...
{mp4Url && <video id="videoRecord" src={mp4Url} controls />}
...

Results

Expected

Video generated from player.recodedData should have same duration as player.record().getDuration(). E.g: 17.123

Actual

Video generated from player.recodedData duration less than player.record().getDuration(). E.g 3.0023 < 17.123

Error output

No error

Additional Information

Please include any additional information necessary here. Including the following:

versions

videojs

what version of videojs does this occur with?
"video.js": "^7.11.4",

browsers

Safari
Version 14.1.1 (15611.2.7.1.6, 15611)

OSes

Mac OS

@thijstriemstra
Copy link
Member

@tonynguyenit18 can you reproduce this without the timeSlice option?

@thijstriemstra thijstriemstra added needs-update duplicate safari-desktop Safari macOS browser issues safari-mobile safari iOS browser issues and removed duplicate safari-desktop Safari macOS browser issues safari-mobile safari iOS browser issues labels Aug 16, 2021
@tonynguyenit18
Copy link
Author

@thijstriemstra Without timeSlice, this issue is gone, but there is another issue occur is player.on("timestamp"....) is not executed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-update safari-desktop Safari macOS browser issues
Projects
None yet
Development

No branches or pull requests

2 participants