• 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 /
This question was closed Oct 23, 2017 at 08:22 AM by signal-inka for the following reason:

The question is related to a tracked issue and a fix is possible (turning off multi-threaded rendering for android)

avatar image
Question by signal-inka · Oct 12, 2017 at 10:39 AM · androidvideovuforia

Unitys VideoPlayer stutters on Android when used in combination with Vuforia

I am working on an augmented reality application and was thrilled when Unitys new VideoPlayer was released, as it was much more compact and easier to handle than the Vuforia Video Playback example code that I was using beforehand.

However, when deploying to Android the videos are stuttering like crazy. The video freezes on random frames while audio (sometimes) presumes. Then a few frames are played again before another freeze happens. I tried different Android phones and had the same results. I tried different codecs, resolutions and enabling / disabling the "Transcode" option of the Editor.

The problem plagues me since I first tried the new VideoPlayer and was occuring when I used the old (non integrated) Vuforia version as well as with Unity 2017.2 or higher with the integrated Vuforia version.

On iOS devices (tested with iPhone 5 and newer devices) the videos play without any problem, same goes for playback in the editor. In contrast, even on current Android devices the problem does occur, which brought me to conclude that it is indeed Android-related.

Does anyone else face a similiar problem? Is this a known bug? I couldn't find anything similar in the issue tracker but before opening a ticket I wanted to check if others faced similiar problems.

Details on the project

  • Simple Image targets, videos are playing on a plane that hovers over a page

  • Videos are switched at runtime (same player is used for 4 different clips)

  • Altogether maybe 20 markers are present in the application, however I reproduced the problem with a minimalistic application and one marker + video

Code of the VideoManager

This section loads the video(s). The plane that the video plays on gets moved to the position in the scene that a plane with a thumbnail is displayed (above the marker).

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.Video;
 
 public class VideoManager : MonoBehaviour {
     public enum VideoID {
         VID_1, VID_2, VID_3, VID_4     
     };
 
     private Transform initialParentTransform;
 
     private VideoPlayer player;
     private VideoID currentVideo;
     private AudioSource audioSource;
 
     private MeshRenderer mRenderer;
 
     void Start () {
         initialParentTransform = gameObject.transform.parent;
 
         player = gameObject.GetComponent<VideoPlayer> ();
         player.prepareCompleted += StartVideo;
         player.errorReceived += LogError;
 
         audioSource = gameObject.GetComponent<AudioSource> ();
 
         mRenderer = gameObject.GetComponent<MeshRenderer> ();
     }
 
     public void PrepareVideo(VideoID id, VideoClip clip) {
         currentVideo = id;
 
         player.clip = clip;
             
         // Prepare Audio
         player.controlledAudioTrackCount = 1;
         player.audioOutputMode = VideoAudioOutputMode.AudioSource;
         player.EnableAudioTrack(0, true);
         player.SetTargetAudioSource(0, audioSource);
         
         player.Prepare ();
     }
 
     private void StartVideo(VideoPlayer p) {
         p.Play ();
         mRenderer.enabled = true;
     }
         
     private void LogError (VideoPlayer player, string error){
         Debug.LogError (error);
     }
 
     public void StopVideo() {
         mRenderer.enabled = false;
 
         if (player != null) {
             player.Stop ();
         }
     }
 
     public void ResetPosition() {
         if (initialParentTransform != null) {
             gameObject.transform.parent = initialParentTransform;
             gameObject.transform.position = Vector3.zero;
             gameObject.transform.rotation = Quaternion.identity;
         }
     }
 }
 




Comment
Dragate
kristianhargas

People who like this

2 Show 2
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
avatar image Dragate · Oct 12, 2017 at 10:45 AM 0
Share

I have the same issue. I'm creating an AR app with Project Tango and unfortunately, Videoplayer sound is stuttering too much. I didn't test it on Android device yet. So far tested it in Unity (before Build). My Unity version is 5.6.4.

avatar image signal-inka · Oct 23, 2017 at 08:19 AM 0
Share

Update: I found this in the issue tracker and tried it with my application. The "solution" (turning off multi-threaded rendering for Android) worked for me as well.

1 Reply

  • Sort: 
avatar image
Best Answer

Answer by signal-inka · Oct 23, 2017 at 08:21 AM

Update: I found this in the issue tracker and tried it with my application. The "solution" (turning off multi-threaded rendering for Android) worked for me as well.

Comment
Dragate

People who like this

1 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

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

155 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

Related Questions

Vuforia: How to play video on another screen till the end after target is detected? 0 Answers

Error with URL video for AR 0 Answers

Video doesn't work on Android 0 Answers

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

Kindle Fire Video Streaming Crash 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