Giter Club home page Giter Club logo

Comments (11)

fregante avatar fregante commented on May 19, 2024

Make sure you .play() it after makeVideoPlayableInline is called. To debug it you'll need to figure out what those script error. are

from iphone-inline-video.

bknill avatar bknill commented on May 19, 2024

Thanks I've had another attempt at this and it's kind of half working - I don't get a pop up and I can hear the video sound.

However as soon as the Three.js mesh with the video gets added to the scene I get constant 'script errors' that appear to show every time it tries to render the scene.

If I use any of

    var video = document.querySelector('video');
    makeVideoPlayableInline(video);

Or the jQuery method I get

http://10.1.1.3/resources/js/beekjs/iphone-inline-video.browser.js:1link
TypeError: Attempted to assign to readonly property.

The video variable is created as such

           video = document.createElement( 'video' );
            video.loop = true;
            video.crossOrigin = '';
            video.preload = 'auto';

If I just use makeVideoPlayableInline(video) with that video variable then it's fine.

So it looks like your code isn't going to work beautifully with Three.js, have you attempted to have it work as a texture?

from iphone-inline-video.

fregante avatar fregante commented on May 19, 2024

iphone-inline-video works with Three.js: http://bfred-it.github.io/iphone-inline-video/demo/threejs.html threex.videotexture/examples/videotexture.html

The problem is somewhere in your code. Make sure it works on the iPad first

from iphone-inline-video.

bknill avatar bknill commented on May 19, 2024

thanks that's useful. This is working fine on desktop and Android, just having massive problems on iOS.

I've been following that code and can get closer, but still can't get the video to show and as soon as it starts to play I get that script errorwhen it tries to render the scene.

Here's how I'm trying to do it

  ``` if(!video){
        video = document.createElement( 'video' );
        video.width = 320;
        video.height = 240;
        //video.autoplay = true;
        video.loop = true;
        video.crossOrigin = '';
        video.preload = 'auto';


    }

    video.src = source = cdnPrefix + "/"+ sceneObject.video;

    geometry = new THREE.SphereGeometry( 500, 60, 40 );
    videoTexture = new THREE.Texture( video );
    videoTexture.minFilter = THREE.LinearFilter;
    videoTexture.magFilter = THREE.LinearFilter;
    videoTexture.format = THREE.RGBFormat;

    videoMaterial = new THREE.MeshBasicMaterial( { map : videoTexture } );`

`        makeVideoPlayableInline(video);
        video.addEventListener('canplay',function(e){console.log('CAN PLAY'); iOSVideo = true});
        video.play();
        showVideo();`

And in the render loop

`    if ( video.readyState === video.HAVE_FUTURE_DATA )
       if ( videoTexture )
            videoTexture.needsUpdate = true;`

from iphone-inline-video.

bknill avatar bknill commented on May 19, 2024

This is the error I get when I console.log the video events

:0
Script error.
"@", "seeking"
"@", "seeked"

from iphone-inline-video.

fregante avatar fregante commented on May 19, 2024

"Script error" says nothing about the error, you'll have to find a better way to debug it. It might just be that Safari is triggering some security error. You'll have to ask on some support forum or StackOverflow if you still have issues because I already showed that it works.

from iphone-inline-video.

bknill avatar bknill commented on May 19, 2024

OK Thanks

from iphone-inline-video.

neuman avatar neuman commented on May 19, 2024

You mentioned that you already showed it works, is there a demo of that anywhere. http://bfred-it.github.io/threex.videotexture/examples/videotexture.html seems to be dead. Thanks!

from iphone-inline-video.

neuman avatar neuman commented on May 19, 2024

@bknill did you ever get this working?

from iphone-inline-video.

fregante avatar fregante commented on May 19, 2024

I created another demo here: http://bfred-it.github.io/iphone-inline-video/demo/threejs.html

Note that Safari doesn't support CORS on videos, so the file has to be on the same domain to make it work.

from iphone-inline-video.

neuman avatar neuman commented on May 19, 2024

That example was exactly what I needed. Thank you very very much.

from iphone-inline-video.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.