RenderHeads / UnityPlugin-AVProVideo

AVPro Video is a multi-platform Unity plugin for advanced video playback
https://www.renderheads.com/products/avpro-video/
226 stars 28 forks source link

When changing the video time, the video often stops. #1253

Closed KimRyuan closed 1 year ago

KimRyuan commented 1 year ago

Describe the issue (I'm using a translator. So I'm sorry if it sounds weird.) When changing the video time, the video often stops. I am currently making a multi-game with video synchronization. (with Photon Network) When a new player entered the video room, I delivered the data of the person watching the video in the room to the new entrant.

Example: If Player A was watching the 35 second part of the video, send Player B a value of "35 seconds". As soon as Player B received the data of 35 seconds, I applied it to the video, and the video stopped. (Use the Seek() function) Wait 30 to 60 seconds and it will play again. I initially expected that the video was not loaded, waited for the video to play for 3 seconds, and applied it after the video was played. But the result was the same.

Was there a similar case? I want to know the cause. I want to make sure the video doesn't stop. If the video has stopped because it is not ready, I would like to easily check whether it is loading or not. Or is there a way to reduce buffering? Are there any useful functions or variables in that part?

Your Setup (please complete the following information):

To Reproduce

  1. Join the Multi-game Room(Scene) (I'm using Photon Network)
  2. change video time
  3. video stop. (Wait 30 to 60 seconds and it will play again.) My scene is already running two more different videos. Is it possible that the computer is lagging due to a lot of video and multi-play?

Screenshots image

If there is not enough explanation, I will send you a video. Please tell me.

Chris-RH commented 1 year ago

Hi @KimRyuan You should probably upgrade to AVPro Video version 2.5.7 as there have been a few improvements to playback in Windows. Are you using the MediaFoundation API?

So when a new person joins the game, you are getting the current frame of the video playing, so that the new user sees the video from that frame?

Are the other videos playing of the same type (resolution? framerate? are they stored locally or from the URL too)?

If you go to Task Manager and look at the Performance tab, what do you see when you are: A) Just running these videos B) Change the video time

KimRyuan commented 1 year ago

I'll upgrade and check those parts! I'm so sorry, I suddenly got another urgent task. It will take some time to upgrade and check. I'll be back next week.. very sorry..

Below is the answer to the question.

I'm not sure what the MediaFoundation API is. I'm using the Media Player component with AVPro mark. (Like a screenshot above)

When a new person participates in the game, all three videos are being played.

Videos are working the same way with the URL I received from the server manager. They're all ".mp4" videos.

in the task manager.. Just running these videos, memory: 275-295MB flow_2022-08-10_105739791 flow_2022-08-10_11027685

Change the video time, memory: 300 to 330 MB flow_2022-08-10_105847659 flow_2022-08-10_1111801

Thank you very much for your quick response! I will definitely reply if it is resolved or not resolved.

Chris-RH commented 1 year ago

This is where you select MediaFoundation API You could disable several options if you don't need them, such as "stereo detection", "text tracks", "facebook audio 260" You could also try enabling the "low latency option" winoptions

KimRyuan commented 1 year ago

After turning off and turning on the settings that you told me, the stop time has been shortened a little and it's gotten a little better! Thanks! still stop, but I thought the video buffering time was inevitable... Is there a way to reduce the buffering time separately?

Our project hasn't been updated to the latest version yet, so I'm looking forward to getting better with the latest version update. Sadly, I started working on something else parts. Someone else will work on the video instead of me. The new worker will update asset. so if there is still problem after the update, I will add it as a new issue.

I am very grateful for your assistance!

Chris-RH commented 1 year ago

How long is the buffering now? Do you get the same buffering if you open them on the same device with different software? Are you connecting via wifi and what is your connection like?

KimRyuan commented 1 year ago

Previously, buffering took about 30 to 60 seconds, but now it has been reduced to 20-30 seconds! When I tested it on our best computer, it took about 15-20 seconds. It seems that buffering is the same. It is used by connecting Internet lines to the computer body. The internet speed is about 150 to 200Mbps.

Chris-RH commented 1 year ago

Ah, that is quite a good improvement so far :)

KimRyuan commented 1 year ago

Asset upgrade successfully completed! Buffering has improved, but sometimes a black screen appears. This phenomenon also occurs only once every 5 to 10 times. The black screen is a phenomenon that has not been before, so I will check again to see if I touched something wrong. image Is this an normal process? display only the Source name and it as 00:00 time.

Other than that, I've discovered a unique feature of Buffering.

  1. Set the 3 videos (A, B, C) to Auto Play.
  2. Access multi-game through photon multi-play environment.
  3. When I control "A" video's time, the video stops.
  4. When I Control "B" video, "A" video begins to play again.
  5. If I Control "C" or "A" video, "B" video play again.

It is also thinking of creating an invisible video "D" and playing "D" when other videos stop. Of course this seems like a bad way..

Chris-RH commented 1 year ago

That blank video with 0.00 suggests that it hasn't opened the media. Is it a particular video that is causing that to occur?

Have you made sure that your media is encoded for fast seeking? https://www.renderheads.com/content/docs/AVProVideo/articles/encoding-notes.html#fast-seeking https://www.renderheads.com/content/docs/AVProVideo/articles/feature-seeking-playbackrate.html

Chris-RH commented 1 year ago

any more info?

KimRyuan commented 1 year ago

I'm sorry for the late reply because I'm on vacation. I'm not sure about the encoding part. Let me check again. Thank you for your sincere response! Here's more information! It doesn't seem like a particular video. If there are videos A, B, and C, video A usually appears on a black screen, but it often appears on video C. The phenomenon seems to occur only one at a time. It appears mainly in multi-mode and does not appear in solo mode (offline) mode.

Could it be a problem if I run multiple clients on one computer?

The problem is not a big deal for us at the moment! Because if I wait, it will turn on eventually. I'll contact you again if I know any clearer appearance reasons/conditions! I'm sorry again for the late reply. Thank you!