Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by QuickSymphony · May 21, 2019 at 02:39 PM · videoapivideo streamingvideos

Incorrect video Length printouts between 2018 and 2019 unity

Hi all. I wanted to write this question here 1st before asking stackoverflow as i'm hoping there is a quick solution to this:

I'm writing a script using the videoplayer functions and noticed a weird bug when trying to get the video Length from a url and not a clip. When using the videoplayer clip you can get the correct length of the video your playing as a double.

However:

  • When using a url you are not allowed to get the Length until the video is prepared.

  • When the video is prepared, you can access it from the scripting API description by using the video.Length function for urls.

  • I do not want a solution involving ANY 3rd party solution currently.

So i've tried dividing the frameCount by the frame rate, tried dividing directly by a number(target frames per second), getting the length from the direct call listed above, and have recieved an issue that i can't solve:

  • When using the clip.length you reccieve exact end time

  • when using the url, the video length in time is rounded down in 2018.

  • when using the url, the video length in time is rounded up in 2019.

  • when using the url, dividing by the frameCount with a direct number will round it down.

  • Run on an update, the end of the video current time reaches the end time of the video(rounded up), but the ending length of the url video then updates and rounds up. (2019)

Question at hand:
- how do i get the exact frame to time length of a url in Unity without it rounding my numbers up/down? I need the length to be exact to the time length.

I've tried:

  • Convert.ToInt64 long to float

  • Convert.ToDouble double to float

both cases round as well.

Since the time lengths on urls are different between engines i'm kind of stuck here. Any information as to why the numbers are rounded differently would be greatly appreciated.

Note:

  • This is to suggest trying a video playback in 2 different versions of Unity and check the ending lengths of a video.

  • getting the videoplayer ".Length" function means updating to Unity 2018.3 or up. Otherwise you have the videoplayer.clip.length as the only accessible way to get a video length as it wasn't added to the api. So your option is to divide by the total frame count. Which is rounded differently. Updating to 2019 this option is present (videoplayer ".Length") but rounds the video length up?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

178 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

AWS Cloudfront RTMP Video Streaming? 1 Answer

How to convert video links to have ".mp4" at the end? 0 Answers

Video Player & GearVR? 1 Answer

Video player http url works in Editor but not in Android ? 1 Answer

Best way to store video content for later playback in Unity? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges