Video Panel System

Posted By: gamers

Video Panel System - 06/23/20 19:21

Hello friends,
I want to create a system where users can watch videos sequentially. If the user hovers over the video with the mouse, I want to make sure that the pause button is displayed on the video and that the video is paused if it clicks. If the mouse does not hover over the video, the video will continue to play. How can I create the structure I show as an example below.
Thank you very much!

[img]https://wetransfer.com/downloads/1c2d7715918cc4cf09e7fa63699f54a520200623192020/339c91/grid[/img]

[img]https://vrl-eu-cdn.wetransfer.net/i...342c316a6c849fcf97cbfddf05405077de20df37[/img]

[img]https://vrl-eu-cdn.wetransfer.net/i...7983e0b3026fe49d1072cbc400a493d25c3ba1e4[/img]
Posted By: Ayumi

Re: Video Panel System - 06/24/20 12:03

Use a Panel and the render to texture feature with "target_map" to render your movie. Use Buttons and Mouse h(over) events to control.
Posted By: gamers

Re: Video Panel System - 07/05/20 09:27

Hello again,
Unfortunately, I couldn't create the structure I wanted to build. Can you create and sgare a video panel system sample, please?
Posted By: Emre

Re: Video Panel System - 07/05/20 12:08

i can't see your example. There is something wrong about your links. Anyway, here is a quick example. This is not the best method but it gives an idea at least. As Ayumi said; you can use buttons etc.

Code
///////////////////////////////
#include <acknex.h>
#include <default.c>
#define PRAGMA_PATH "%EXE_DIR%\templates\images";
#define PRAGMA_PATH "%EXE_DIR%\samples";


//panel bitmap
BMAP* video_bmap="#512x512x24";
BMAP* pause_button="rock.tga";

//video handle
var vid_handle;


PANEL* video_panel=
{
	layer=1;
	bmap=video_bmap;
	flags=SHOW;
}

function pause_event()
{
	//pause the video
	media_pause(vid_handle);
}
PANEL* pause_button_panel=
{
	layer=3;
	bmap=pause_button;
	
	//if click the pause button
	on_click=pause_event;
}


function main()
{
	fps_max=75;
	video_mode=9;
	video_screen=2;
	wait(3);
	
		
	//play video on panel
	vid_handle=media_loop("blabla.avi",video_panel.bmap,100);

	mouse_mode=4;
	mouse_pointer=2;




	while(1)
	{
		
		//mosue over
		if(mouse_pos.x>video_panel.pos_x&&
		mouse_pos.x<video_panel.pos_x+video_panel.size_x&&
		mouse_pos.y>video_panel.pos_y&&
		mouse_pos.y<video_panel.pos_y+video_panel.size_y)
		{
			//show pause button
			set(pause_button_panel,SHOW);
			draw_text("PAUSE",pause_button_panel.pos_x,pause_button_panel.pos_y,COLOR_RED);
		}
		else//not
		{
			//resume video 
			media_start(vid_handle);
			
			//hide pause button
			reset(pause_button_panel,SHOW);
		}
		wait(1);
	}
}



Posted By: gamers

Re: Video Panel System - 07/06/20 08:48

Thanks Emre!
I examined the example you shared. Based on this example, I can create the structure I want. Thank you again for your contributions laugh
Posted By: Emre

Re: Video Panel System - 07/06/20 09:39

I'm happy to help. smile
© 2024 lite-C Forums