[SOLVED] Uploading and playing Video


#1

Does anyone know if it’s possible to upload and play a video directly from the Playcanvas editor? I tried following the video textures tutorial but it seems to require a video to be hosted on an external site, which I don’t have. I tried uploading a .mp4 file to Playcanvas, but it imported as an audio asset, and I don’t know how to play the visual part.

Thanks


[SOLVED] Video in PlayCanvas Project
Audio Settings not in Editor
#2

Even though PlayCanvas editor thinks it is audio, it doesn’t process/modify the file in any way so it is still a video file.

I’ve made a sample project showing a video that I’ve uploaded to PlayCanvas and playing it to a texture: https://playcanvas.com/editor/scene/574109


#3

Thanks so much, worked like a charm :grinning:


#4

Hi Yaustar,

I get this error using your code

[launch.js:7535]: Uncaught TypeError: Cannot read property ‘split’ of undefined

TypeError: Cannot read property ‘split’ of undefined
at console.error (https://launch.playcanvas.com/editor/scene/js/launch.js:7535:36)
at ResourceLoader. (https://code.playcanvas.com/playcanvas-stable.dbg.js:37650:23)
at AudioContext.error (https://code.playcanvas.com/playcanvas-stable.dbg.js:38065:7)

I noticed your project settings has Audio, mine doesn’t, so I can’t enable legacy audio

Is there a workaround for the current playcanvas editor online?

Or do I need a special tier account?

Thanks,
-ANton


#5

I don’t get any errors running my old project. Can you send a link to yours that is showing this error please?

I don’t know what you mean by this?


#6

No worries, I figured out the issue. The mp4 video I uploaded was corrupt. The real issue is that I can’t load videos as textures on my iPhone so I thought loading local videos instead of cross-domain videos would solve the issue but I was wrong. Although local videos may work on full-screen on iPhone, mapping it onto a texture doesn’t work. I have yet to see a working example of this. If you know of any PlayCanvas developer that can give me an example of a video texture that I could load and see work on my iPhone, please let me know. I can even pay for them to debug my code. Need to fix this issue as soon as possible so that I can continue with the classically animated video production (that will be added as textures within my game).


#7

I’m afraid I don’t have a iOS device to test with. The thing to note that I think both iOS Safari and Android Chrome prevent autoplaying or at the very least prevent audio from video autoplaying without some user interaction (like a tap or a click on the screen).


#8

Actually, can you check this published build please on iOS? https://playcanv.as/p/rCIoFmmr/


#9

Sorry for the late reply.
I checked on my iPhone and the tv screens remain black even after I press the screen.

I’m trying to find any working PlayCanvas examples of video texturing specifically working on my iPhone but haven’t yet seen a working example. Sucks.


#10

So I tapped harder before the tv falls. The video loads full screen and one I exit full screen the tv graphics breaks. See attached image. This is sumiliar to what happens in my own game. The entire graphics of the game becomes corrupted


#11

That’s interesting :thinking:. Looks like iOS Safari does something different with video. Unfortunately, I don’t have an iOS device to test against and check the console logs.


#12

For me on iOS, when I tap the screen, the image on the TV turns from black to the first frame of BBB. Then, a full-screen video player pops up showing a black screen but playing the audio of the video ( a yawn sound ).

If I close the video, I see the correct visual of the 3D models with a static image on the TV from the movie ( I’m not what Anton is seeing, where the orange part of the TV is missing ).

iPhone 6S Plus, Safari or Chrome, using /p/ or /e/p/


#13

My phone is 5s, so maybe that makes things worse than your 6s. But according to Safari’s inline attribute being accommodated with these devices, theoretically it should be fine in both devices.


#14

Anton, speaking of differences, can you try out the link on this thread and post your results - there def seems to be strange things going on with PlayCanvas and iOS!


#15

Here is the console error:

SecurityError (DOM Exception 18): The operation is insecure.


#16

texImage2D — playcanvas-stable.min.js:4934:591SecurityError (DOM Exception 18): The operation is insecure.


#17

done. it’s about 11 fps