Tool QSP QSP Player With Video Support Written In Qt

toolkitxx

Well-Known Member
Modder
Donor
Game Developer
May 3, 2017
1,473
1,794
The user Sonnix on TFG has provided this excellent new version of a QSP Player which not only supports a wider range of picture and video formats (webm, webp, mp4) but is also multi-platform (Versions for Windows, MacOS and Linux) and .

Since we have a large number of QSP games here on F95 i contacted him to ensure that this is not a one-shot and he would allow usage elsewhere than on TFG.

I quote him here: 'The player can be used for any projects without any limitations. And since the original qsp library is under LGPLv2.1 license I can not limit anything if I am to follow it since my player is a derivative work.
I've just posted the links in pleases where this player might be useful.

Usage in another projects is a good test for the player. So if you find any bugs you can report them to me and I will try and fix them.
'

My own tests so far have not shown any issues so i wanted to share this with everyone.

Version 1.9:
Win64:
Win32:

Here is version 1.9 for macOS:


Minimal supported OS version should be macOS 10.12.

For Linux versions please check Sonnix's posts in this thread for details if and where available.

git:
 
Last edited:

Alexander Krisnov

The Dead Commisar
Uploader
Sep 14, 2016
1,852
22,021
i have been using that for my own project mp4 video for testing... works the same way as a gif but the sound if there is any also comes with it
 

toolkitxx

Well-Known Member
Modder
Donor
Game Developer
May 3, 2017
1,473
1,794
Replacement for a gif would be a webm regarding feature. But you are right that mp4 also works smoothly and adds sound to picture.
 

toolkitxx

Well-Known Member
Modder
Donor
Game Developer
May 3, 2017
1,473
1,794
A small addendum for the less technical inclined people:

This player is really a blessing for anyone who wants to modify or create a new game based on QSP.

QSP had a huge advantage over other languages as it was tightly tied into the actual player functionality. Simple commands would send an action right into the right frame allowing for rapid development of mostly text-based games and freeing the dev from thinking about the UI/GUI stuff.

With this player @Sonnix opened up QSP to fully utilize html5 commands inside a game thus basically eliminating the need for QSP Navigator in the future. Older games will run as they always have but they can now be enhanced with things that are common in modern browsers like video and SVG.
 

ShadowStrike

New Member
Feb 17, 2018
3
2
I have problems with both QSPs. Using standart QSP gives this warning "video element lacking src" and doesn't show any videos. @Sonnix version works with videos BUT only if "video loop" tick is removed from the settings. So once the video ends, it just stays there, no way to replay it. I don't remember having any problems with vids using standart QSP before so I don't know what to do. I've used google to search for an answer but nothing.
 
  • Like
Reactions: carmennnoiu

toolkitxx

Well-Known Member
Modder
Donor
Game Developer
May 3, 2017
1,473
1,794
I think your problem might be related to how you create the actual video address to the video itself.
Your html command has to be in line with html5 standard for this - so if you want controls etc basically like this:
Code:
'<video width="320" video width="320" height="240" autoplay loop controls><source src="images/Chess.mp4" type="video/mp4"></video>'
P.S: But i have to agree with your obeservation about the unticking of autoplay and loop. That might be something @Sonnix could have a look at.

As of your statement that you used video with 'standard qsp' - i highly doubt that. There have been only 3 possible ways to play video thus far: Using awesomnium version (also called navigator), a undocumented propriety version of a qsp player build by the Girl Life group and Sonnix's player. The 'classic' player has never been able to play video - only gif.

P.P.S. You could actually also use some inline javascript stuff if you want to control every bit of the controls. Something along this for example:
Code:
<script>
var myVideo = document.getElementById("video1");

function playPause() {
    if (myVideo.paused)
        myVideo.play();
    else
        myVideo.pause();
}
</script>
 
Last edited:
  • Like
Reactions: ShadowStrike

toolkitxx

Well-Known Member
Modder
Donor
Game Developer
May 3, 2017
1,473
1,794
Just to emphasize that again: my earlier posting is purely related to Sonnix's player. This will NOT work in any of the other players!
 
  • Like
Reactions: carmennnoiu

toolkitxx

Well-Known Member
Modder
Donor
Game Developer
May 3, 2017
1,473
1,794
Can the timing be conrtrolled like HTML5 video?
If you mean starting a video at specific times - basically yes. But that isnt a html5 tag but solved via extra javascript which is supported inline by Sonnix's player.
 

Sonnix

Newbie
Dec 25, 2017
19
40
Sorry for not ansering for so long.

Some info on video playback. "Force autoplay and loop for video" option was designed only as transaction mechanism from old rich text video playback and html5. It would only work for video tags that are in the format of img tags and it just adds <video autoplay loop>. So normally this option should not be used at all and you would just use a full html5 video tag. Also this option may be removed from future versions.
With the player I also post examples from time to time. It includes video playback test with autoplay that works without any additional options or javascript. So it might be helpful if someone posted a link to examples here as well.

By timing I assume media fragments? They should be supported. But due to how links are handled there might be a bug right now that assumes the part after # in src is also a part of file name. Or there might be a bug in QtWebEngine. I will have to check why this might not work.
For now I've included javascript version to the example.

I've updated the player. So it would be nice if someone updated the links here. It includes some experimental features so it might be a good idea to live old links as well.

Windows version now uses Qt 5.11.1.
New version includes action hotkey display and line wrap for actions. So no I think all the UI functions from the classic player are implemented.

Also for the new version I've added an ability to add custom elements to the <head> part of the page. This allows to set custom css and javascript file for the page. To test this you need to enable "HTML5 Extras" option in settings.
To set the header you need to set $SETMAINDESCHEAD variable for the main description and $SETSTATHEAD for additional description. Like so:
$SETMAINDESCHEAD = '<link rel="stylesheet" href="example.css">'
Right now it will persist across locations once set. So if you don't need it anymore you would have to set it to empty string ($SETMAINDESCHEAD = '') or use KILLVAR.
I'm interested in feedback on this feature. And suggestions on how to implement this.

In future I might include more features to bridge html5 features to player.
 
  • Like
Reactions: toolkitxx

Sonnix

Newbie
Dec 25, 2017
19
40
There is another small update that fixes media fragments. Now you should be able to set start and end for the video in src with it's url.
It should be noted however that with media fragment set the loop for the video will not work (tested it in normal browser and it does not work there as well).

There are also some minor UI improvements in new version.
 

Sonnix

Newbie
Dec 25, 2017
19
40
I've released a new version. Also I think now I can post links here.

Version 1.7:
Win32:
Win64:
macOS:

git:

In this version I've fixed sound volume settings.
Added support for loading config file from player folder (might be useful if you want to bundle the player with the game and want to customize auto start settings).
Added support for default css styles via custom.css file in the game folder.
Added support for calling qsp commands from JavaScript (only QSPExecString for now).

Also now DOCTYPE is defined as <!DOCTYPE html> which results in HTML5 standard. This disables HTML4.01 quirks mode for html parsing.
With this change tables now inherit base document style which results in correct font if it is set by user in settings.
For fonts player now differentiate how it was set. If it was set from within qsp then it can be overridden by CSS. If it was set by the user then it will override any other setting.

I did not have time to finish an example for this update. So example on how to use styles and JS calls will be uploaded later separately.
 

zero42

New Member
Jun 28, 2017
4
3
Sonnix, I'd like to request Linux releases if possible.

Also, is there a list of games you test for compatibility, or is this mostly intended for authors of new games?
 

toolkitxx

Well-Known Member
Modder
Donor
Game Developer
May 3, 2017
1,473
1,794
Sonnix, I'd like to request Linux releases if possible.

Also, is there a list of games you test for compatibility, or is this mostly intended for authors of new games?
I can at least answer your second part:
Any game that uses/used the regular 'classic' player as a base will run with Sonnix's player (Office career would be one example for this). Many games used awesomnium to circumvent certain restrictions - those wont work with this player (Son of a bitch is an example for those).
 
  • Like
Reactions: zero42

Sonnix

Newbie
Dec 25, 2017
19
40
Sonnix, I'd like to request Linux releases if possible.

Also, is there a list of games you test for compatibility, or is this mostly intended for authors of new games?
Will try and do a Linux release when I have time. Right now in AppImage builds multimedia does not work (GStreamer tries to use system plugins for decoding instead of bundled ones). So for the next release I will try to use Flatpak. But mostly usable for gnome applications. KDE runtime has Qt but for proprietary codecs to work I need a custom build so I cant just use that. So I will have to make a custom runtime first.
I really whish that there was something like LXC or Docker for gui applications where you could easily bundle your application on top of existing Linux distribution and pack it as a single file container. But instead every project presents the runtime in their own way with just the thing they think are important.

Code for decoding qsp is almost the same as in classic player. Only the way content is displayed is changed in the player to include new features. So any game that works in the classic player will work with this player. Even the save games made in different players should be compatible. The only difference can be how the text is displayed. So the text size style and alignment sometimes may be a bit different but it should not be game breaking. It's just that HTML5 standard is a bit more strict on how to parce the tags. And some old games relied on html4.01 quirks mode which was never a part of any standard. So it the game does not fallow the standard there might be display problems. If it fallows the standard then the game should look the same as in classic player.

Awesomnium (Quest Navigator) with a bit of work might actually work in this player. All the required html stuff is already supported. And in the last version basic JavaScript bridge was added. The difference between the classic and Awesomnium player is that Awesomnium issues qsp calls from JavaScript. So the required calls just need to be implemented.
 

Xorgroth

Well-Known Member
Modder
Oct 12, 2017
1,153
1,174
Awesomnium support would be great and Linux support would be also be a huge bonus if doable. I don't use KDE or Gnome though, it's pretty much just lxde. Though think lxde uses some GTK2/3+ and Openbox libraries. Probably just need to add the qt libraries, know I got a qt5 based sdr app on my Debian box.
 

toolkitxx

Well-Known Member
Modder
Donor
Game Developer
May 3, 2017
1,473
1,794
@Sonnix Sorry to bug you man but i have a question slash request:
As far as i can tell you havnt changed anything in the behaviour of saving a game, correct? Because one thing that bugs me is that the actual settings of the frames seems to 'reset' whenever the player gets closed down and starts with some frames disabled. Is there a way i have overlooked to change that so the saved game 'remembers' the setup of the player frames at time of the save?
 
Last edited:

toolkitxx

Well-Known Member
Modder
Donor
Game Developer
May 3, 2017
1,473
1,794
Sorry for not ansering for so long.

Some info on video playback. "Force autoplay and loop for video" option was designed only as transaction mechanism from old rich text video playback and html5. It would only work for video tags that are in the format of img tags and it just adds <video autoplay loop>. So normally this option should not be used at all and you would just use a full html5 video tag. Also this option may be removed from future versions.
With the player I also post examples from time to time. It includes video playback test with autoplay that works without any additional options or javascript. So it might be helpful if someone posted a link to examples here as well.

By timing I assume media fragments? They should be supported. But due to how links are handled there might be a bug right now that assumes the part after # in src is also a part of file name. Or there might be a bug in QtWebEngine. I will have to check why this might not work.
For now I've included javascript version to the example.

I've updated the player. So it would be nice if someone updated the links here. It includes some experimental features so it might be a good idea to live old links as well.

Windows version now uses Qt 5.11.1.
New version includes action hotkey display and line wrap for actions. So no I think all the UI functions from the classic player are implemented.

Also for the new version I've added an ability to add custom elements to the <head> part of the page. This allows to set custom css and javascript file for the page. To test this you need to enable "HTML5 Extras" option in settings.
To set the header you need to set $SETMAINDESCHEAD variable for the main description and $SETSTATHEAD for additional description. Like so:
$SETMAINDESCHEAD = '<link rel="stylesheet" href="example.css">'
Right now it will persist across locations once set. So if you don't need it anymore you would have to set it to empty string ($SETMAINDESCHEAD = '') or use KILLVAR.
I'm interested in feedback on this feature. And suggestions on how to implement this.

In future I might include more features to bridge html5 features to player.
Sorry for the late reply to this - i was still busywith the core stuff and hadnt have time to play with this.
Soooo - you are a genius man! Works just like a charm. Played with css-stylesheet for the main frame extensively and its just working spotless.
 

Sonnix

Newbie
Dec 25, 2017
19
40
@Sonnix Sorry to bug you man but i have a question slash request:
As far as i can tell you havnt changed anything in the behaviour of saving a game, correct? Because one thing that bugs me is that the actual settings of the frames seems to 'reset' whenever the player gets closed down and starts with some frames disabled. Is there a way i have overlooked to change that so the saved game 'remembers' the setup of the player frames at time of the save?
Saving and loading should be the same as in original player. They just use the functions from the original library.
Frame visibility should be saved as well. The only difference that might be inconsistent is window size.
If you try and save inside dynamic call (DYNAMIC, DYNEVAL) then the evaluated state might be different after you load it. It is also this way in original player.

If you have examples of save games that work different in different players or you think might have problems then you can send them to me and I will take a look at them when I have the time.
 
  • Like
Reactions: toolkitxx