Online video player

Want to change something on the site? Or add new features?
Post Reply
thefinerminer
Site Admin
Posts: 136
Joined: Tue Jan 08, 2008 3:33 pm
Location: UK, Scotland
Contact:

Online video player

Post by thefinerminer »

I would like to create a web video player for the rankings but have limited time. Any volunteers?

The idea is to use javascript to draw into an HTML canvas. I have programs to extract information from videos, we just need to draw.

HTML canvas lets you draw images on co-ordinates (it is easy to draw an Intermediate game with 256 16*16 pixel images in exact locations) and there is a drawing function for lines (you can take the mouse path from the video and draw a line following the mouse coordinates).

A really simple tutorial is here: https://www.w3schools.com/graphics/canvas_intro.asp

You can get MSX graphics here: https://minesweepergame.com/download/mi ... _skins.zip

The RAW format gives the board layout and every mouse event. I've attached a small example and have programs to automatically read all videos. You can see column 1 is time, column 2 is mouse event (left click, left release, movement, etc), column 3 is cell, column 4 is mouse coordinates. Visual events (flag, cell press down, numbers) are also recorded. It is just a case of drawing the events (and later calculating a stats counter).

Let me know if you're interested!
Attachments
Example.JPG
Example.JPG (47.54 KiB) Viewed 472 times
User avatar
Flop
Posts: 7
Joined: Wed May 12, 2021 4:36 am

Re: Online video player

Post by Flop »

I have previous experience in writing web video players, and you can see the results through this link: https://hgraceb.github.io/web-minesweeper-demo.

The code used in the above link was written at the very beginning and has not been maintained for a long time. The latest code has been archived to China Minesweeper: http://www.saolei.wang/Main/Index.asp, check the details of any video and click "在线播放" to see the effect of the latest code.

I wrote this web video player before, not through the HTML canvas way to draw, but directly using the container for flow content to achieve, such as "div".

I'm currently a full-time Android developer, web development is the only amateur, but I can find time to develop it outside of work, so if there is no more suitable person willing to develop this web video player, I'm happy to help develop it.
User avatar
Tommy
Posts: 255
Joined: Mon Dec 01, 2008 9:22 pm
Location: Vienna

Re: Online video player

Post by Tommy »

Flop wrote: Wed May 12, 2021 5:17 am I have previous experience in writing web video players, and you can see the results through this link: https://hgraceb.github.io/web-minesweeper-demo.

The code used in the above link was written at the very beginning and has not been maintained for a long time. The latest code has been archived to China Minesweeper: http://www.saolei.wang/Main/Index.asp, check the details of any video and click "在线播放" to see the effect of the latest code.

I wrote this web video player before, not through the HTML canvas way to draw, but directly using the container for flow content to achieve, such as "div".

I'm currently a full-time Android developer, web development is the only amateur, but I can find time to develop it outside of work, so if there is no more suitable person willing to develop this web video player, I'm happy to help develop it.
Damn, that looks nice! I like the arbiter-style counters :)

I also have a video player on Scoreganizer. It's far from done, which is why it isn't linked to from anywhere, but it looks like this:
https://scoreganizer.net/streaming/watc ... play/77311
(This game is Kamil's best game from the 2015 wch)

This player is based on qqwref's JS version: http://mzrg.com/js/mine/multi.html

Also, we've decided to turn Scoreganizer's player into an open-source project that I will maintain, and intend to keep using on Scoreganizer. So - that will be an option, but also, it probably won't be as fancy, at least in the near future - I'll probably add basic video controls, but am unlikely to bother with counters anytime soon as that significantly increases complexity and there are many other minesweeper-related projects I'd like to work on.
Don't anthropomorphize computers - they don't like it.
thefinerminer
Site Admin
Posts: 136
Joined: Tue Jan 08, 2008 3:33 pm
Location: UK, Scotland
Contact:

Re: Online video player

Post by thefinerminer »

Hi Flop,

After talking to Tommy we think your version is the best approach :mrgreen:

I attached a ZIP file with 4 files:

- Arbiter 0.52.3 video translated to a text file
- Viennasweeper 3.0H video translated to a text file
- Both files translated into "RAW" format with all board events

On the website I can easily call a function to convert videos to the RAW format. It works for Viennasweeper (all versions), Arbiter (0.44 and later), Clone (0.76 and later) and MSX (all versions).

I guess your version works for Arbiter and directly calculates the board events? Or do you use the old RAW script in the forum (which has some bugs).

It would be great to discuss!
Attachments
raw_videos.zip
Videos files converted to text files
(30.05 KiB) Downloaded 6 times
User avatar
Flop
Posts: 7
Joined: Wed May 12, 2021 4:36 am

Re: Online video player

Post by Flop »

thefinerminer wrote: Fri May 21, 2021 4:46 pm Hi Flop,

After talking to Tommy we think your version is the best approach :mrgreen:

I attached a ZIP file with 4 files:

- Arbiter 0.52.3 video translated to a text file
- Viennasweeper 3.0H video translated to a text file
- Both files translated into "RAW" format with all board events

On the website I can easily call a function to convert videos to the RAW format. It works for Viennasweeper (all versions), Arbiter (0.44 and later), Clone (0.76 and later) and MSX (all versions).

I guess your version works for Arbiter and directly calculates the board events? Or do you use the old RAW script in the forum (which has some bugs).

It would be great to discuss!
I am delighted to have contributed to the development of the web video player 😄.

I'm currently parsing Arbiter videos using the method provided in this post: viewtopic.php?t=86. I've rewritten the main parsing logic using JavaScript. You say you can easily translate so many formats into "RAW" video files, what language is it written in, and is it currently open source? Also is there a specific specification for "RAW" video files so that I can parse them better?

I've looked at the attached video file you've provided and have written a simple demo to show how it looks in practice, which you can view here: https://hgraceb.github.io/web-minesweeper-player/. It is important to note that the web video player I wrote does not support Internet Explorer, as I did not want to spend time on something that would not enhance my skills. And it seems that Internet Explorer is about to stop being maintained.

As I also maintain the video player on Saolei.wang, the idea is that this site and Saolei.wang can use the same project code for web video player to better reuse the code, which will make my maintenance work easier and give more people the opportunity to participate in the development and maintenance together. The source code and how to use it can be viewed here: https://github.com/hgraceb/web-minesweeper-player

If you are comfortable with this approach, please first tell me what features are necessary and what features would make the player better but not so necessary. I will dedicate time to optimizing and fixing the current problems with the code, such as the fact that it does not currently support playing custom videos, is not multi-lingual, and so on. Once the code has been optimized and most of the issues have been resolved, the next step will be to prioritize and develop all the features that are needed.

Due to my capacity and time constraints, and the fact that this is my first project when I first learned to program, I can provide a version of the video player for now, although there are still a lot of problems, so if anyone has better ideas or comments, please feel free to tell me.
thefinerminer
Site Admin
Posts: 136
Joined: Tue Jan 08, 2008 3:33 pm
Location: UK, Scotland
Contact:

Re: Online video player

Post by thefinerminer »

Nice work, Flop!

I added your code to the website and it works perfectly.

[EDIT - I deleted a bug report from this post. Video displayed incorrectly in Firefox because browser was 90%. Changed to 100% and graphics work perfectly.]

The good news is that your program reads:

1) direct from Arbiter videos
2) from the RAW file (the direct translation with no added features)
3) the standard RAVWF file (with board events and features added).

I created RAW files for Arbiter 0.46 & 0.52, MSX 1.15, Viennasweeper 2.2 & 3.0 and Clone 2006. Your program worked except MSX. I guess the reason is MSX saves some clicks before the game starts (negative time).
User avatar
Flop
Posts: 7
Joined: Wed May 12, 2021 4:36 am

Re: Online video player

Post by Flop »

thefinerminer wrote: Sun May 23, 2021 5:44 pm Nice work, Flop!

I added your code to the website and it works perfectly.

[EDIT - I deleted a bug report from this post. Video displayed incorrectly in Firefox because browser was 90%. Changed to 100% and graphics work perfectly.]

The good news is that your program reads:

1) direct from Arbiter videos
2) from the RAW file (the direct translation with no added features)
3) the standard RAVWF file (with board events and features added).

I created RAW files for Arbiter 0.46 & 0.52, MSX 1.15, Viennasweeper 2.2 & 3.0 and Clone 2006. Your program worked except MSX. I guess the reason is MSX saves some clicks before the game starts (negative time).
I fixed them.

1) The MSX video was not playing properly, I fixed it, but I need your help to verify it again and see if it plays properly on your end.
2) Browser layout misalignment at 90% zoom, although you may not think it's a bug, I fixed it too, it's the damn "border" property that causes it 😠.
thefinerminer
Site Admin
Posts: 136
Joined: Tue Jan 08, 2008 3:33 pm
Location: UK, Scotland
Contact:

Re: Online video player

Post by thefinerminer »

Hi Flop,

I have published updated parsers for all versions: https://github.com/thefinerminer/minesweeper-rawvf

The parsers convert Arbiter, MSX, Clone, VSweep into RAWVF. Please test if your player can read each the output.

(To run a binary use a command line and type "parser_program video.abc>video.txt".)

There is an optional RAWVF2RAWVF ("parser_raw") file which adds board events and statistics, but your player already calculates this information from the RAWVF format. Nice work!
thefinerminer
Site Admin
Posts: 136
Joined: Tue Jan 08, 2008 3:33 pm
Location: UK, Scotland
Contact:

Re: Online video player

Post by thefinerminer »

Hi Flop,

Thanks for updating your code. I found one bug...

Your regex does not like Minesweeper X rawvf because it the text file has one extra column. The picture shows the extra column which can say (), (l), (lr), (r), etc. It was an optional column that only MSX used. When I delete this column the video player works perfectly.
Attachments
47.txt.zip
Delete "zip" from the name.
(103.71 KiB) Downloaded 3 times
mvr.jpg
mvr.jpg (22.13 KiB) Viewed 233 times
User avatar
Flop
Posts: 7
Joined: Wed May 12, 2021 4:36 am

Re: Online video player

Post by Flop »

thefinerminer wrote: Tue Jun 08, 2021 9:31 pm Hi Flop,

Thanks for updating your code. I found one bug...

Your regex does not like Minesweeper X rawvf because it the text file has one extra column. The picture shows the extra column which can say (), (l), (lr), (r), etc. It was an optional column that only MSX used. When I delete this column the video player works perfectly.
Hi Damien,

Thanks for your feedback, I'm sorry for taking so long to reply to you, as you know, I would have received an email if there was a reply, but this time I don't know why not. That's why I just saw it now, I've fixed the bug just now.

I've been taking some time to improve the video player a lot lately, and I think it's almost all functional now. I've integrated it into my video player using Emscripten, based on the parsing code you posted to Github for different formats of video, and of course with support for custom levels, and a new i18n configuration.

At this point, I think there are only two issues left.

1) How to deal with the messy code problem of 'player'. Do you think you pass a player corresponding to the country or code, and I do the mapping to parse, or do you provide a callback through the back-end code for me to get the 'player' after decoding it? From what I know, for example, there is a library in Python: chardet, which can guess and parse the encoding of the string.

2) Currently my video player already supports direct playback of rawvf, avf, mvf, rmv formats. I don't support fsvf and umf because I don't have any video for testing, and I don't support mvr because you said the author of MinesweeperX maintains a copy of the code himself, but I don't know how to get it. Do you think this is OK, or is there some way I can test the parsing of videos in fsvf, umf, and mvr formats?

For any other needs, you can talk to me directly in this thread about me, or contact me through my email.
thefinerminer
Site Admin
Posts: 136
Joined: Tue Jan 08, 2008 3:33 pm
Location: UK, Scotland
Contact:

Re: Online video player

Post by thefinerminer »

The video player is live on the world rankings!

You can click a link to watch any video in the browser (and play the same board UPK in the browser).

Thanks to Flop for his code. My implementation is slightly different than the version used on saolei.wang. To keep things simple (for me) I used my parsing tools (so I deleted all the parsing code) and I use the remaining source code directly (instead of compiling into WebAssembly) which required some changes (such as not using modules) and displaying in a modal.

I notice there is hidden code for a menu and if Flop adds code to place mines then you could actually play games (at the moment you can only UPK the game that was loaded). Interesting...
User avatar
Flop
Posts: 7
Joined: Wed May 12, 2021 4:36 am

Re: Online video player

Post by Flop »

thefinerminer wrote: Sat Aug 28, 2021 11:16 am The video player is live on the world rankings!

You can click a link to watch any video in the browser (and play the same board UPK in the browser).

Thanks to Flop for his code. My implementation is slightly different than the version used on saolei.wang. To keep things simple (for me) I used my parsing tools (so I deleted all the parsing code) and I use the remaining source code directly (instead of compiling into WebAssembly) which required some changes (such as not using modules) and displaying in a modal.

I notice there is hidden code for a menu and if Flop adds code to place mines then you could actually play games (at the moment you can only UPK the game that was loaded). Interesting...
I am delighted to be able to make my contribution to the development of this website.

The current web video player I feel has a lot of room for improvement, so I recently did a refactoring of the current project using parser_raw.c code to refactor the current project, but I found a few issues that I hope you can refine if you have time, or is there anyone who can do this?

I've tried to do the fix myself, but a Pull requests I submitted over two months ago has not been followed up on either.

The problems found so far are as follows.

1. The events associated with the question mark, such as the normal remove question mark event and the question mark setting toggle event, do not work correctly. See the attached MinesweeperX_Int.mvr for the source of the test video, which should only parse correctly if the game is won.

2. Not friendly to events outside the board, some events outside the board may cause the state of some cells to be incorrectly determined. See the attached arbiter_int.avf for the source file of the test video, the converted part of the relevant code is as follows.

Code: Select all

   Events:
   ...
   Cell pressed 14 16
   ...
   18.070 lr 17 17 (256 256)
   ...
   Cell pressed 14 16
   ...
   
3. There is a problem with the calculation of the distance data, only mouse movement events are involved in the calculation, but in fact, other events also affect the final distance data, and the result does not match the FreeSweeper 10 calculation. See the attached arbiter_int.avf for the source file of the trial video, the converted part of the relevant code is as follows.

Code: Select all

   Events:
   0.000 lc 3 1 (36 6)
   0.000 lr 2 1 (27 1)
   0.000 mv 2 1 (23 1)
   ...
   
There may be other problems, if anyone is willing to fix them I will give feedback when I find them, if not I will have to maintain a separate code to fix them myself.
Attachments
MinesweeperX_Int.mvr
(66.27 KiB) Not downloaded yet
arbiter_int.avf
(44.22 KiB) Downloaded 1 time
EWQMinesweeper
Posts: 419
Joined: Sun Nov 30, 2008 11:50 pm

Re: Online video player

Post by EWQMinesweeper »

Can my replays on the site be shown without the name displayed below the board or maybe even be taken entirely off the site?
„Das perlt jetzt aber richtig über, ma sagn. Mach ma' noch'n Bier! Wie heißt das? Biddä! Bidddää! Biddddäää! Reiner Weltladen!“
User avatar
Flop
Posts: 7
Joined: Wed May 12, 2021 4:36 am

Re: Online video player

Post by Flop »

EWQMinesweeper wrote: Sun Sep 05, 2021 11:53 am Can my replays on the site be shown without the name displayed below the board or maybe even be taken entirely off the site?
This feature is currently not available. You can download the video to view it from the video playback page.
EWQMinesweeper
Posts: 419
Joined: Sun Nov 30, 2008 11:50 pm

Re: Online video player

Post by EWQMinesweeper »

Flop wrote: Mon Sep 06, 2021 5:02 am
EWQMinesweeper wrote: Sun Sep 05, 2021 11:53 am Can my replays on the site be shown without the name displayed below the board or maybe even be taken entirely off the site?
This feature is currently not available. You can download the video to view it from the video playback page.
I think you may have misunderstood what I wrote. My videos are currently already on there. I would like that either the name is not shown below the boards or that my videos are removed from the site.
„Das perlt jetzt aber richtig über, ma sagn. Mach ma' noch'n Bier! Wie heißt das? Biddä! Bidddää! Biddddäää! Reiner Weltladen!“
User avatar
Flop
Posts: 7
Joined: Wed May 12, 2021 4:36 am

Re: Online video player

Post by Flop »

EWQMinesweeper wrote: Tue Sep 07, 2021 10:23 am I think you may have misunderstood what I wrote. My videos are currently already on there. I would like that either the name is not shown below the boards or that my videos are removed from the site.
I'm sorry that I didn't understand you before.

This relates to the actual code and user data of the site and it is recommended to contact the webmaster, the owner of this post, directly using the site mail or email.
thefinerminer
Site Admin
Posts: 136
Joined: Tue Jan 08, 2008 3:33 pm
Location: UK, Scotland
Contact:

Re: Online video player

Post by thefinerminer »

Hi EWQMinesweeper / Flop,

I use a modified version of Flop's video player (I replaced the video parsing code with mine, but I use Flop's amazing code for the video player). I just added some lines and now after a video is turned into RAW text, the real name is replaced with "Anonymous" if the player has the "Hide my real name" setting turned on in their profile.

Thanks for suggesting a privacy improvement. Other privacy controls include 1) players can hide real name on rankings 2) profile pictures and biographies can only be seen if you are logged into the site 3) search engines are blocked from crawling profiles and pictures and video files.
Post Reply