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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

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
Add comment · 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

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



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

Videoplayer basic controls guide.. 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges