Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
0
Question by Delamore81 · Jan 05, 2015 at 01:22 AM · webglvideomovietexturehtml5

WebGL - Video

So I gather that currently WebGL builds does not offer support for the class "movietexture". Is there any way that I can play videos in HTML5/WebGL (using Unity of course or else I would not post this question here)?

As of now, I can only think of applying a video texture on a plane to play videos. And I came across Jonas Echterhoff's proof-of-concept html5 video playback code which he posted in some forum but I was unable to find his forum. He mentioned it here.

Any ideas anyone?

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 Whozi · Nov 27, 2015 at 10:21 AM 0
Share

I tested the WEBGL Video Asset found in the Assetstore and it works fine on $$anonymous$$esh Renderer but i wasnt able to make it work on the CanvasRenderer in a Raw Image UI Component. Any way to do this? Any help here?

5 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Bentoon · Jan 12, 2015 at 09:13 PM

Very interesting question. Video on a plane works beautifully in most cases. Try Video Texture Pro (free in asset store. Though I'm sure donations are appreciated)

I have heard whispers that Unity 5.something will have a lot of video support

~be

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 Delamore81 · Jan 14, 2015 at 02:17 AM 0
Share

The thing is... I am doing this in Unity 5.1 Beta Pro version. I believe Unity's movietexture is currently the only way to play videos on surfaces. The following is the breakdown of the usability of that feature. As you will see, not much has changed since Unity 4 with regards to video.

  1. $$anonymous$$ovieTexture is not supported in WebGL.

  2. $$anonymous$$ovieTexture is not supported in iOS. The alternative way to play videos is to use HandHeld.PlayFullScreen (requires iOS Pro) which only plays the video fullscreen. But for anyone who wants to play videos on a surface, well sorry.

  3. $$anonymous$$ovieTexture is not supported in Android. Same story as above. Also Needs Android Pro.

I just hoped things really changed for the better when the final version of Unity 5 is released.

BUT anyways, thank you very much for your suggestion of Video Texture Pro. I think this is way better than another plugin I found (and paid good money for) in the asset store called "Video Player" by $$anonymous$$12. Unfortunately, for this plugin, I later realized I was not able to pause and resume videos. It works quite well on iOS too but not on WebGL, contrary to what they advertised.

avatar image
0

Answer by jtothebell · Mar 07, 2015 at 02:06 AM

I was hoping for a solution to this problem as well, and I started writing a wrapper around Jonas' sample that you linked to in your question. Basically there is a wrapper class the uses the normal MovieTexture class if you are in the editor, web player or standalone, but uses Jonas' WebGL movie texture proof of concept when you deploy to WebGL. It was working in my initial tests, but I've since gotten sidetracked on other things and haven't had a chance to really harden it.

https://github.com/jtothebell/UnityStreamingMovieTexture

Comment
Add comment · Show 4 · 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 Sujil-V-S · Feb 18, 2016 at 10:59 AM 0
Share

Hello, When I tried to use this Wrapper for a WebGL build i was getting the following error

 An error occured running the Unity content on this page. See your browser's JavaScript console for more info. The error was: Uncaught SecurityError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': The video element contains cross-origin data, and may not be loaded.

Can u help me with this?

avatar image varumora Sujil-V-S · Feb 24, 2016 at 11:39 AM 0
Share

I had that problem but managed to fix it adding this line

 video.setAttribute('crossorigin', 'anonymous');

in the WebGL$$anonymous$$ovieTextureCreate function

EDIT: I got the answer from here:

http://stackoverflow.com/questions/26127462/three-js-uncaught-securityerror-failed-to-execute-teximage2d-on-webglrenderi

avatar image Sujil-V-S · Mar 03, 2016 at 06:21 AM 0
Share

An error occured running the Unity content on this page. See your browser's JavaScript console for more info. The error was: Uncaught SecurityError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': The video element contains cross-origin data, and may not be loaded.

The above error i removed by keeping the video in the same server. But now only sound is co$$anonymous$$g from the video, nothing is displaying.

avatar image Chandramohan-Pal Sujil-V-S · Mar 31, 2016 at 03:21 AM 0
Share

Even, I am also facing the same issue with safari browser.It's working fine in chrome and firefox. But it's giving following error in safari " INVALID_VALUE: texImage2D: no video".

avatar image
0

Answer by Sujil-V-S · Mar 31, 2016 at 09:05 AM

Hello. Finally found a solution for this. In WebGLMovieTexture.jslib I updated the following method.

WebGLMovieTextureUpdate: function(video, tex) { if (videoInstances[video].paused) return; if (videoInstances[video].readyState < videoInstances[video].HAVE_CURRENT_DATA) return; GLctx.bindTexture(GLctx.TEXTURE_2D, GL.textures[tex]); GLctx.pixelStorei(GLctx.UNPACK_FLIP_Y_WEBGL, true); GLctx.texImage2D(GLctx.TEXTURE_2D, 0, GLctx.RGBA, GLctx.RGBA, GLctx.UNSIGNED_BYTE, videoInstances[video]); GLctx.texParameteri(GLctx.TEXTURE_2D, GLctx.TEXTURE_WRAP_T, GLctx.CLAMP_TO_EDGE); GLctx.texParameteri(GLctx.TEXTURE_2D, GLctx.TEXTURE_WRAP_S, GLctx.CLAMP_TO_EDGE); GLctx.texParameteri(GLctx.TEXTURE_2D, GLctx.TEXTURE_MAG_FILTER, GLctx.LINEAR); GLctx.texParameteri(GLctx.TEXTURE_2D, GLctx.TEXTURE_MIN_FILTER, GLctx.LINEAR); GLctx.pixelStorei(GLctx.UNPACK_FLIP_Y_WEBGL, false); },

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
avatar image
0

Answer by omrip32 · Jan 10, 2017 at 06:23 PM

I'm also trying to use RawImage component for the rendering and having no luck so far.. I looked at this link (which the poster claimed that he solved the issue http://answers.unity3d.com/questions/1208911/how-to-use-a-rawimage-with-simple-movietextures-fo.html) but that solution didn't work as well.. Any help is greatly appreciated!

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
avatar image
0

Answer by nsmith1024 · Jan 21, 2017 at 11:46 PM

Anybody knows how to get WebGLMovieTexture to stop playing a video and start playing a new video at a new URL?

I cant seem to get it to do that other than creating a new instance of WebGLMovieTexture, and then it now has TWO video streams going the first and the second. even if I use Stop() (it stops the playback) but it still streaming the video data from the internet in the background.

How do I tell it to stop playback and start playing a new video from the new 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

33 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

Related Questions

Screen Recording in WebGL 0 Answers

VideoPlayer not playing in WebGL Build 0 Answers

Youtube videos in Unity WebGL 2020.3 0 Answers

How stocked the video in full screen in the background? 0 Answers

Various documentation about movie formats is confusing... 1 Answer


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