Play videos with 4D

Automatically translated from English

We’re in the visual and interactive content era. It’s becoming increasingly more and more prominent. Take a look at digital community statistics and you’ll discover that YouTube is the second most popular social network.

At some point, most web developers want to include videos in their sites and coincidentally, databases frequently contain links to videos (either hosted locally or on the web). This post shows you two ways to include videos in your 4D applications.

Use an external player

One option is to open your videos with an external player. With the OPEN URL command, the video will be opened in the operating system’s default player.

OPEN URL(".../myVideo.mp4")

Play video in your forms

But you may want play your videos internally, i.e. within your 4D application forms. So why not use an HTML player in a web area with the WA OPEN URL command instead?

C_TEXT($htmlPath;$html)
$html:="<html><body>"
$html:=$html+"<video width=\"400\"controls>"
$html:=$html+"<source src=\"myVideo.mp4\" type=\"video/mp4\">"
$html:=$html+"Your browser does not support HTML5 video."
$html:=$html+"</video>"
$html:=$html+"</body></html>"

$htmlPath:=Temporary folder+"myHTML.html"
TEXT TO DOCUMENT($htmlPath;$html)

WA OPEN URL(*;"Web Area";$htmlPath)

More information about the HTML player can be found on the w3schools web site.

Vanessa Talbot

• Product Owner •

Vanessa Talbot joined 4D Program team in June, 2014. As a Product Owner, she is in charge of writing the user stories then translating it to functional specifications. Her role is also to make sure that the feature implementation delivered is meeting the customer need.

Since her arrival, she has worked to define key features in 4D. She has worked on most of preemptive multi-threading new features and also on a very complex subject: the new architecture for engined application. Vanessa has a degree from Telecom Saint-Etienne. She began her career at the Criminal Research Institute as a developer for the audiovisual department. She has also worked in media and medical fields as expert in technical support, production as well as documenting new features.