Video on multiple platforms


#1

Hi,
Coming from a background of multimedia developments with the Flash / AIR / ActionScript ecosistem, I am now learning Haxe / OpenFL Haxe / OpenFL in the face of a possible future without the option of Adobe AIR.

We have quite specific needs, among others, we need to play integrated video on several platforms. Priority:

  • Windows exe (events, presentations …)
  • Html5 canvas (Browser, online)
  • Android app (events, presentations …)
  • (iOS is not necessary, for now)

I know that I can compile for the Flash and Adobe AIR targets, but as I say, we need an option without the need for AIR if in the future it is not possible to execute it in said targets.

I have been looking at quite a lot of information about OpenFL and it seems that the possibilities of integrating video in several platforms, is quite problematic (or even there is no solution in some targets) …

Windows exe

Hardly anything is found. The most we find is this:


But we can not compile it because it gives an error:
“Error: VlcBitmap.cpp ./src/vlc/VlcBitmap.cpp(681): error C2573: ‘vlc :: VlcBitmap_obj’: can not delete pointers to objects of this type; …”

Does anyone have a solution for this error ?.

Is there any plan for the future so we can integrate video in Openfl / windows target)?

Html5 canvas

We know that it is possible to work with Html5 canvas in different platforms (even to create executables with electron), but canvas has several technological problems. Among many other things, it is VERY slow when there is text (or vectors) on the screen, which forces to convert everything to bitmap to obtain an acceptable performance. This produces longer times in the projects.

We work with Adobe AIR in a mix between gpu mode and vectors. We do not absolutely convert everything to bitmap, because it is not necessary. The texts are very agile in general without converting and they look “crisp”. The performance is very good in windows exe and mobile app. But this solution is not possible in html5 canvas.

In general, Html5 canvas is a inferior solution to the global possibilities and the balance that Flash Runtimes allow.

This option simply interests us to have a web / online version, without the need to reprogram everything from scratch (right now we do it through createjs).

Android app

Similar needs to Windows exe. For events, sometimes we need to run it on an Android Tablet (we usually have the possibility to choose the type of system, so we do not need iOS, for now). But we do not see video solution for mobile targets …

Is there any option to play video in an Android app ?. Is there any future plan that allows having a Video Player on Android?

Thank you!


#2

We support HTML5 video using WebGL.

We also (in addition to Adobe AIR) have beta support for Electron (npm install -g electron, haxelib install electron, then openfl test electron), which allows HTML5-based desktop applications.

WebM might be a good path for native video support:

This extension was working for playing video, but I don’t think it had audio sync, and I’m sure the performance could be improved. We’ve also considered Ogg Theora


#3

I have managed to make HaxeVLC work in windows. I have forked HaxeVLC with the changes here:

I have made some comments to the modifications here:

I also have to comment that the executable windows has to be generated in 32bits (because I suppose that the vlc libraries of the project are in 32). By adding -32 to the parameter line.

What I have not managed to start the webm extension. I got the following error when compiling … "C: /HaxeToolkit/haxe/lib/openfl-webm/0,0,4/webm/Webm.hx: 31: characters 58-70: flash.utils.ByteArray has not field getData "

I have modified the function parameter from ByteArray to Bytes in Webm.hx, and got it to compile, but even correcting that, when it is executed it jumps an alert such that: “Could not load module openfl-webm @ hx_vpx_codec_iface_name_0”

So I have not got webm to work …

I have to try more in depth HaxeVLC in a more complex project (several integrated videos). Maybe for windows we can use this solution.

Is there any video solution for Android?

For us html5 canvas is not valid for offline projects. Even with Electron.

Thank you


Never ending video in cpp
#4

Did you do openfl rebuild openfl-webm windows to rebuild the native binary?


#5

When trying the rebuild it gives several errors:

Link: …/ndll/Windows/openfl-webm.ndll
Creando biblioteca obj/lib/openfl-webm.lib y objeto obj/lib/openfl-webm.expvpx.lib(postproc.c.o) : error LNK2001: símbolo externo _vsnprintf sin resolver
LIBCMT.lib(vsnprintf.obj) : error LNK2001: símbolo externo _vsnprintf sin resolver
vpx.lib(vp8_dx_iface.c.o) : error LNK2001: símbolo externo _vsnprintf sin resolver
vpx.lib(onyxd_if.c.o) : error LNK2001: símbolo externo _vsnprintf sin resolver
vpx.lib(threading.c.o) : error LNK2001: símbolo externo _vsnprintf sin resolver
vpx.lib(decodframe.c.o) : error LNK2001: símbolo externo _vsnprintf sin resolver

LIBCMT.lib(vsnprintf.obj) : error LNK2001: símbolo externo __vsnprintf sin resolver
obj/lib/openfl-webm.ndll : fatal error LNK1120: 2 externos sin resolver

I’ve tried it on two different computers.


#6

What version of Visual Studio are you using?

I read this on MSDN:

Beginning with the UCRT in Visual Studio 2015 and Windows 10, vsnprintf is no longer identical to _vsnprintf . The vsnprintf function complies with the C99 standard; _vnsprintf is retained for backward compatibility with older Visual Studio code.

I’m not sure if this matters, if we need to modify the library to use a different version?


#7

Visual Studio 2017

I do not know exactly what the problem may be (I have no knowledge of c ++). Is there no way that the library works out of the box ?. As with other extensions?


#8

Does it compile any differently if you replace vsnprintf with _vnsprintf in the library?


#9

I just do not know where to change that … In what file?

The package has been installed here: C: \ HaxeToolkit \ haxe \ lib \ openfl-webm \ 0,0,4 \

I tried (blindly, without knowing) to run “clean.bat” and then “build_windows.bat”. A similar error (_vnsprintf) occurs in other files. But as I say, I’m not used to working with a C ++ file structure

If you tell me a source file (with the path where it is, because there are many branches in that structure) I can open it and replace vsnprintf with _vnsprintf.


#10

Maybe here? https://github.com/HaxeExtension/extension-webm/search?q=vsnprintf&unscoped_q=vsnprintf


#11

Dont know if extension-web is the same version as openfl-webm, but the content of the files does not match …

I have searched in an editor all the matches of vsnprintf in the whole local structure, and I have modified it manually with _vsnprintf. The result of the compilation is similar:

C: \ HaxeToolkit \ haxe \ lib \ openfl-webm \ 0,0,4> openfl rebuild openfl-webm windows
Link: …/ndll/Windows/openfl-webm.ndll
Creating library obj / lib / openfl-webm.lib and object obj / lib / openfl-webm.exp
vpx.lib (postproc.c.o): error LNK2001: external symbol _vsnprintf unresolved
LIBCMT.lib (vsnprintf.obj): error LNK2001: external symbol _vsnprintf unresolved
vpx.lib (vp8_dx_iface.c.o): error LNK2001: external symbol _vsnprintf unresolved
vpx.lib (onyxd_if.c.o): error LNK2001: external symbol _vsnprintf unresolved
vpx.lib (threading.c.o): error LNK2001: external symbol _vsnprintf unresolved
vpx.lib (decodframe.c.o): error LNK2001: external symbol _vsnprintf unresolved

LIBCMT.lib (vsnprintf.obj): error LNK2001: external symbol __vsnprintf unresolved
obj / lib / openfl-webm.ndll: fatal error LNK1120: 2 external unresolved


#12

oh, interesting:

https://social.msdn.microsoft.com/Forums/en-US/5150eeec-4427-440f-ab19-aecb26113d31/updated-to-vs-2015-and-now-get-unresolved-external-errors?forum=vcgeneral

Perhaps it does not need to be changed, but needs additional headers in each file, like <stdio.h>?


#13

It seems that the files containing vnsprintf, already contained the #include <stdio.h>

We tested even on Android app and although it creates the apk, the problem is exactly the same.
Called from webm.Webm::boot webm/Webm.hx line 159
Called from cpp.Lib::load C:\HaxeToolkit\haxe\std/cpp/Lib.hx line 38
“Could not load module [email protected]_vpx_codec_iface_name__0”

So I do not know how to get it going …

Ok, anyway for everything I read, the webm extension seems to have enough problems with video / audio, and at the same time it seems old (5 years old?) And “abandoned” …

For us to have video (at least at the level of what Flash Player / AIR provides) is very important. Very few of our projects do not carry any video.

We have managed to develop a Class that allows us to play video with the same API on three platforms: Flash / AIR, Html5, Windows (using HaxeVLC from Datee - our modified github fork -). If I have time, at some point I will upload it to Github with an example of integration. This “api” is far from perfect but at the moment it can be valid for those targets (a pity that for Android app there is no alternative …).

So I hope (I pray, especially when AIR stops working in our main targets) that in the future this feature is an integral part of Haxe / OpenFL (including mobile app Android + iOS).

We will be aware of any developments in this area.

Thank you,


#14

We are in the same situation here. What prevents us to use OpenFL on all our projets is mainly the lack of video solution on some targets (windows & Android especially).
Can we hope that video on on target will be part of one of the next versions?
It would be really GREAT :slight_smile:


#15

Currently, the workaround is to use html5 + electron or cordova.
But yeah, it would be great! Maybe we should create a bounty for this?


#16

For us, html5 canvas with integrated video is “cr#p” (slow and less features). Html5 canvas, in general, gives less performance than any other target (working with the same amount of effort, it is more difficult to obtain canvas performance).

I prefer to export to: Windows, Android app, (and/or AIR while available). These platforms as the “prime version”. And a html5 canvas version as a backup (but never as the “best version” of the product). Unless the product is exclusively browser and the development is relatively “simple”. In any other case it is not profitable. Al least for us.

Like I said in other forum: “Browser engines - canvas - are not the best runtimes for multimedia like products”.

I just hope that more and more developers in the OpenFL community need this feature in multiplatform (or al least “main native platforms”), because at present it seems stagnant.


#17

We support DOM, canvas or WebGL on HTML5. I’ve been consistently impressed how well WebGL performs compared to other targets


#18

I’m going to publish linc_ffmpeg (ffmpeg v4.1 externs) with openfl&kha examples of how to play media files and capture camera input in near future, when I have time.


#19

GREAT to hear!
Is it working fine?


#20

Yes it is. At least on Windows platform. I plan to test it on other platforms as well.