• 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 /
avatar image
Question by Sir-Gatlin · Jul 03, 2017 at 06:01 PM · playervrvideovideo streaming

IS Videoplayer.preparecompleted pointless?

So I assumed Videoplayer.preparecompleted would trigger when the video is prepared. I assumed that meant the video was fully loaded and ready to play front to back with not needing to download anymore. but when using it, it looks like it means all prep was made to get the video player ready to play and can start playing it, but no promises to how much of the video is loaded. If I call video.prepare and wait to play on preparecompleted it video does not play, it shows the first frame and freezes. It works better to just use .play, but then after a few seconds it stops due to needing to load.

All i want is a way to track load progress. I want to be able to know how much of my video from url is loaded, so i know when it is safe to start playing the video with no interruptions.

Comment

People who like this

0 Show 0
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

1 Reply

  • Sort: 
avatar image

Answer by Virat-Gangurde · Jul 04, 2020 at 10:52 AM

Hi!

The usual way to play a movie from the web, with Unity, is to point the VideoPlayer to the movie using the VideoPlayer.url property and calling Play(). But this, as you are pointing out, does not report buffering progress and is indeed a missing feature in the VideoPlayer that we may address eventually.

Here are two options; none of them is perfect but maybe adequate for your use case: Instead of calling VideoPlayer.Play() immediately, you can add a handler on the VideoPlayer.prepareCompleted event and then call VideoPlayer.Prepare(). This does not expose progress, but at least you can have a spinning cursor in the mean time and have it disappear as soon as buffering is considered sufficient to start playback. If it's acceptable for you to not start the playback until the movie is fully downloaded, then you can just use UnityWebRequest.Get directly to download the file locally. This will get you the same progress reporting that you're using for textures. Once downloaded, you can have your VideoPlayer use the local file by setting the VideoPlayer.url property to the filesystem path of the downloaded file. Hope this helps,

Comment

People who like this

0 Show 0 · Share
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

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta by June 9. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

95 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

Related Questions

play back 360 video STEREO on GearVR 1 Answer

pre-prepare video in scene before its needed 0 Answers

Can handheld.PlayfullScreenMovie() work with Vr view to play 360 degree video using google vr sdk? 0 Answers

Handle Player between multiple scene [SteamVR Plugin] 1 Answer

Android build - videoplayer - cannot read .mp4 file 1 Answer


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