Search Issue Tracker
Fixed in 5.6.0
Votes
2
Found in
5.6.0b4
Issue ID
875185
Regression
No
VideoPlayer does not play Video if url is set via script on WebGL
VideoPlayer on WebGL does not play Video if url is set via script.
To reproduce:
1. Build and run attached project for on WebGL platform
Expected Result: video is played on the cube
Actual Result: no video is played
Reproducible: 5.6.0b5, 5.6.0b6
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Physics SyncColliders 3x-7x performance regression from 2022LTS to U6
- ListView's '+' button causes a recursively dispatching event when the visual element area is filled up
- Soft keyboard closes immediately after multiple touches are made if Pointer Behavior is set to SingleUnifiedPointer
- UI Image batching breaks when interleaving elements with mixed z-positions and materials
- KeyNotFoundException is thrown when retrieving some values from HyperLinkClickedEventArgs
jsteinkamp
Apr 12, 2020 20:44
Use this code on an object it will generate a videPayer, type in the name of video file in Inspectpr
using UnityEngine;
using System.IO;
using UnityEngine.Video;
public class video_on_object : MonoBehaviour
{
private UnityEngine.Video.VideoPlayer videoPlayer;
public string videofile;
public GameObject this_object_cam;
void Start()
{
GameObject cam = this.gameObject;
videoPlayer = cam.AddComponent<UnityEngine.Video.VideoPlayer>();
// Obtain the location of the video clip.
videoPlayer.url = Path.Combine(Application.streamingAssetsPath, videofile);
videoPlayer.isLooping = true;
videoPlayer.Play();
}
}
ykswobel
Mar 16, 2020 18:52
still not fixed.... 2019.3.5f1... this engine is one step forward two backwards
luisquid
Jul 05, 2018 22:07
Guys, if you are reading videos from a url that are hosted on a server that you own you need to give the server the adequate permissions for the webgl app to load external URLs. It's not a Unity issue, but it's something that took me a while to figure it out.
FiveFingers
Jun 01, 2018 05:44
Guys, the videoplayer is a relatively recent feature, is still evolving, if you import your media in your app, the videos are smooth in the editor, absent in the WebGL build, because they were wrongly encoded in the import settings.
If you use video.url, of course, it depends what kind of video and audio codec were used to bake that specific .mp4 / .ogv video and what code did you use in unity also.
Streaming a video from an URL is so different than playing a local resource. Do you agree ?
Anyway WebGL issue is about encoding formats / bit rate. Try to use a lower bitrate for compressing your mp4 (make it larger in the size, not smaller and with a lower bit rate and try again).
Numonic
Feb 07, 2018 16:52
Im on unity 2017 and same issue does not play video on webgl at all.
FireHawkX
Apr 21, 2017 14:12
ehhh... I am currently using Unity 2017.1.0b1 and this is definitely not fixed..
My mp4 video are set using url's... they work great in engine... they work great in exe export...
but the whole thing crash when played using the WebGL version...
And its not like video are too big... 3 of them are below 5mb total!
I have been searching all over unity forums, trackers, google, etc for the last 3 hours and I cannot find anything except this bug report...
I think the only difference is that I play mine using the "new" video player component in a canvas and not as a texture on a cube...
I did a search for "Video Player WebGL" in the tracker, went through the first 3 pages... i'm wondering if i should not try and create a small project and create a bug report of my own...