VideoPlayerDemo.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. /****************************************************************************
  2. * Copyright 2019 Nreal Techonology Limited. All rights reserved.
  3. *
  4. * This file is part of NRSDK.
  5. *
  6. * https://www.nreal.ai/
  7. *
  8. *****************************************************************************/
  9. using UnityEngine;
  10. using UnityEngine.Video;
  11. namespace NRKernal.NRExamples
  12. {
  13. public class VideoPlayerDemo : MonoBehaviour
  14. {
  15. public VideoPlayer videoPlayer;
  16. public ScreenApapter screenApapter;
  17. private void Start()
  18. {
  19. videoPlayer.Play();
  20. videoPlayer.prepareCompleted += VideoPlayer_prepareCompleted;
  21. }
  22. private void VideoPlayer_prepareCompleted(VideoPlayer source)
  23. {
  24. screenApapter.SetContent(source.texture);
  25. }
  26. }
  27. }