Skip to content

ThirteeNov

My personal blog about coding and internet

Menu
  • About me
  • About Zofia Kreasi
  • Cart
  • Checkout
  • Making an airplane game from scratch in Unity
  • My account
  • Privacy Policy
  • Privacy Policy – zkLeaderboard
  • Sample Page
  • Shop
  • Tutorials on Learning JavaScript
  • ZKAccounts – Privacy Policy
Menu

How to load a video file from a url and play it in Unity

Posted on November 30, 2020January 25, 2021 by Habibie

This script can help you to load a video file stored somewhere on internet. So by accessing its link, you can load and play it in Unity.

This method can be useful to make minimal installation file size of your program, you don’t have to embed your video but you can ask your user to connect to the internet to play it.

Here is the script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Video;

public class OnlineVideoLoader : MonoBehaviour
{
	
	public VideoPlayer videoPlayer;
	public string videoUrl = "yourvideourl";
	
    // Start is called before the first frame update
    void Start()
    {
		videoPlayer.url = videoUrl;
		videoPlayer.audioOutputMode = VideoAudioOutputMode.AudioSource;
		videoPlayer.EnableAudioTrack (0, true);
		videoPlayer.Prepare ();
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}

Watch how I did it:

You can download the complete example project from this link: https://drive.google.com/file/d/1q28h_ZDewM0DPXPjzb8niEwwxRMcPWPH/view?usp=sharing

Post Views: 839
ciihuy2020

Welcome!

  • My YouTube Channel
  • My GitHub Page
  • About me

Categories

  • 3DVista
  • Android
  • Apache
  • C#
  • Cordova
  • Electron & Node JS
  • HTML5, CSS & JavaScript
  • iOS
  • Let's Make Unity Games
  • Misc
  • Photoshop
  • PHP
  • Python
  • Uncategorized
  • Unity
  • WordPress

Recent Posts

  • Hover Reveal script for Unity to show and hide object on mouse hover
  • How to Prevent UI Clicks in Unity from “Bleeding Through” to 3D Objects Behind Them
  • Make objects like wires and cables easily in Unity using Ciihuy Curved Mesh
  • [SOLVED] Can’t Add Custom Domain to Blogger After Losing CNAME Verification
  • iOS App Icon Generator by CiihuyCom
© 2026 ThirteeNov | Powered by Superbs Personal Blog theme