Can I put some video in Defold?

I want to put in my project some video files between levels. Can Defold give me that possibility?

1 Like

Not yet, sorry. We are working on an extension system that could bring that possibility, but there is no ETA yet when that will be ready for external use.

If your game is meant to be played on mobile, I believe you could use webview for playing videos. For desktop / web you could have videos hosted on YouTube, and allow user to click to open the cutscene link to view online.

Cant he use a webview to a file in his project which could contain html5 video?
i mean its hackery, but should work pretty fine :slight_smile: annnnd without internet usage!

He should be able to (someone should test!), but only on iOS/Android as only those targets support webview.

Something like http://www.awesomium.com/ could potentially add webview support to desktop (useful for other reasons too), and HTML5 builds need a “webivew” container thing made somehow.

Any progress on this?

We have a small example of how to play .webm video using libvpx in our VideoPlayer extension.

Note that it doesn’t currently play the sound of the video
Also, using an emscripten compiled version of libvpx for html5 apparently gives very low performance.
Anyways, it shows to the possibilities of our native extensions functionality.

5 Likes

Hi @Mathias_Westerdahl , Can the video framerate be increased or decreased dynamically?

Also apart of getting metadata, is it also possible to set it?

Hi @Todor_Imreorov
Well, the goal of the example was to play videos at 1x speed. I’m not sure how difficult it would be to alter either the play speed or setting the metadata.

2 Likes

It would be great if we could at least set playback speed- allowing for more interesting interaction with the video files

@Mathias_Westerdahl looking at the source code,
this line:

If we could instead do
m_Time += dt * playbackSpeed

or perhaps something to be done with m_VpxCtx.framerate ?

and expose playbackSpeed to lua, that might do it? My c++ skills are very limited unfortunately. If I had more experience would have given it a try. Maybe @britzl or @Pkeod would be more capable of adding this.

Do you know any good tutorials on starting with c++ and c++ plugins for defold?

That’s already exposed to Lua. You can just call videoplayer.update() with a scaled dt.

1 Like

@dapetcu21 not sure if that would work, will give it a try

@Mathias_Westerdahl is it possible to seek in the video and get progress? How do we for example tell the video to loop from the 2nd second to the 5th second for example?

Ok I tried compiling with this plugin and I get some build errors:

Yeah. The example doesn’t work on Windows. I remember trying to make it work and couldn’t since libvpx’s symbols clashed with the libvpx already compiled into defold.

Is there no way of directly accessing the one bundled with defold?

I guess that means that we can’t play videos on any of the operating systems really - not even android?

anyways, I am leaning between python + kivy or appgamekit or phaser- all three other options have seek, and actually work- but come with some other cons.
The implementation in AGK is somewhat buggy on some video files. Python+kivy create a giant executable. Phaser is the best, but requires me to put the game in electron or cordova

Unity also has a good one, but unity is huge and I want something leaner.
game maker can do it too- but I havent tested it yet- it has multiple video player implementations- not one

I’m took a quick look at the videoplayer extension. I wasn’t able to build it due to a change to dmBuffer::GetStream. I’ll grab @Mathias_Westerdahl tomorrow and see what can be done.

1 Like

It’s on my todo to fix so that it compiles properly again!

2 Likes

I have now updated the extension-videoplayer example to build properly again.

6 Likes

Would be awesome if we also had a way to set the time of the video.

Defold being a 3d engine could really laverage from doing something with 360 videos and vr - the way unity is doing atm

They are really ahead of everyone atm

Really all you need is to be able to play the video onto a sphere with inverted normals
The unity devs were clever and collaborated directly with google to come up with an out of the box kit to do vr video interactive content


Facebook and other websites are also highly interested in interactive video content creation. There is a market to be had here imo. Most smartphones are going to be vr- ready and google is releasing their Daydream platform too

3 Likes