Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • 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
2
Question by shay4545 · Jun 27, 2017 at 03:47 AM · unity5videourlvideo streamingplayback

Using VideoPlayer to stream a video from a website

I'm trying to use the new VideoPlayer feature to play a video from a website (my dropbox link). I can't seem to figure out the right url format to get the video to play. I've just been copying the video link from dropbox and putting it in as the url but that doesn't seem to work. I've also tried videos from other websites and couldn't get those to work either. I tried actually bringing the video file into unity and playing it directly instead of through the url and it works fine. Here's the code I have: (I press a button in the scene to begin playing the video)

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.Video;
 
 public class Test : MonoBehaviour {
     
     Camera cam;
     UnityEngine.Video.VideoPlayer vid;
     AudioSource aud;
 
     void Start () {
         cam = Camera.main;
         aud = cam.GetComponent<AudioSource> ();
         vid = cam.GetComponent<UnityEngine.Video.VideoPlayer> ();
         vid.renderMode = UnityEngine.Video.VideoRenderMode.CameraNearPlane;
         vid.url = "https://www.dropbox.com/s/cquqv1zb31b04p4/Vid-648155715.ogv?dl=0";
         vid.audioOutputMode = VideoAudioOutputMode.AudioSource;
         vid.EnableAudioTrack (0, true);
         vid.SetTargetAudioSource (0, aud);
         vid.Prepare ();
     }
 
     void Update () {
         Debug.Log (vid.isPlaying);
     }
 
     public void PlayMovie(){
         vid.Play ();
     }
 }

Does the video have to be in a certain format for unity to play it? And how can I fix this so I can play the video through the url? Or would there be a better way to handle playing these videos without streaming them from a website? (I intend to have hundreds of videos so I didn't think having them all locally in unity would be very efficient)

Comment
Add comment · Show 1
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 qasim78986784 · Feb 21, 2018 at 10:10 AM 0
Share

Audio is not playing for that video? What's the issue ?

3 Replies

· Add your reply
  • Sort: 
avatar image
7

Answer by Sir-Gatlin · Jul 03, 2017 at 06:07 PM

normally you would host the videos on a server of your own. Dropbox does work but it takes a little bit of tweaking, replace your url "https://www.dropbox.com/s/cquqv1zb31b04p4/Vid-648155715.ogv?dl=0" with "https://dl.dropbox.com/s/cquqv1zb31b04p4/Vid-648155715.ogv" when using videos from dropbox you get rid of everything after the filename, and change www > dl

of course I am not sure if the videoplayer supports .ogv a good test is try playing the video locally, if video player can play the file type locally it should be able to do it from a url.

Comment
Add comment · Show 6 · 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
avatar image qasim78986784 · Feb 21, 2018 at 10:10 AM 0
Share

Audio is not playing for that video? What's the issue ?

avatar image Sir-Gatlin qasim78986784 · Feb 21, 2018 at 02:39 PM 0
Share

did you create and assign an audio source? if you do have an audio source I would suggest pulling the video directly into your project to see if you can get audio working. cause it could be a codex issue. let me know how it goes.

avatar image busyxiang · Feb 25, 2019 at 04:38 AM 0
Share

I have a problem when strea$$anonymous$$g the video in android where it only able to stream like the first 10 seconds of the video then it suddenly stops strea$$anonymous$$g. But the video player works fine in the editor. Do you know any solutions to this issue?

avatar image ershadd busyxiang · Aug 02, 2020 at 01:00 PM 0
Share

did you find any solution for that?

avatar image lbarrionuevo busyxiang · Jan 25, 2021 at 05:36 PM 0
Share

Hello! I am at the same step, I have the video lag problem. The time of this delay is 5 seconds, how to solve this problem? please help!

avatar image waencumsuraeni · Dec 09, 2019 at 03:15 AM 1
Share

Finally, i can play videos via URL. Thank You so much.

avatar image
3

Answer by Lilo_stitch · Feb 08, 2019 at 05:26 PM

First upload the video on your dropbox by clicking upload file .. Once it is uploaded click share button you will find button called 'copy link 'click it ...alt text

if your url was like this 'https://www.dropbox.com/s/r0zz33afd5khmcr/MyFriendWhatIfMyTourWasWithYou.mp4?dl=0' go to unity and add video player alt text

make two changes to the url ..First one is replace 'www' with 'dl' ..Second one , at the end instead of dl=0 make it equal 1 ( look at the second screenshot and compare the url with one written above )


drop-4.png (13.7 kB)
drop3.png (16.0 kB)
Comment
Add comment · Show 1 · 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
avatar image unity_WaxAKLpwrs0dng · Dec 02, 2020 at 12:34 AM 0
Share

Wow this is super helpful, thank you a lot! This only works for me in the editor however... when I upload the build to my website with the dropbox link in the videoplayer as you showed, the video doesn't show up. Am I doing something wrong? It also doesn't work if I "build and run" the game.

avatar image
-1

Answer by erez1158 · Oct 12, 2019 at 07:16 PM

I'm facing the same issue, only that I'm trying to stream a video from Vimeo. Is there any changes I need to make in order for the VideoPlayer be able to read the URL?

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.

Follow this Question

Answers Answers and Comments

85 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

Related Questions

play back 360 video STEREO on GearVR 1 Answer

Video Player URL Stream Dropbox Video in Android Has Bug, but works fine in editor 0 Answers

Video streaming from a web server in android 0 Answers

Playing Video in Unity 5 (on mobile) 4 Answers

Streaming video from web server in android 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