Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Wed Jan 17, 2018 10:20 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: keep/maintain the aspect ratio of Movie player ?
PostPosted: Sat Apr 07, 2012 9:10 am 
Offline

Joined: Tue Dec 27, 2011 8:54 am
Posts: 139
Location: India
Hi All,

I have a desktop application where i put an Movie Player controls and having a list box so that user can select any movie item from the menu list.

Quote:
My point is : 1# How to keep/maintain the aspect ratio of the Movie player in any resolutions with any size. That may be laptop or any size of desktop or any viewer and support both WIndows and MAC.




Thanks,
Prakash

_________________
PK Pothal
Software Developer in REAL STUDIO 2011r4.3, ASP.NET, VB.NET, C# AND SQL SERVER 2005/08
OS:WINDOWS N MAC


Top
 Profile  
Reply with quote  
 Post subject: Re: keep/maintain the aspect ratio of Movie player ?
PostPosted: Sun Apr 08, 2012 3:21 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
You can pick the scaling code here:

http://monkeybreadsoftware.de/Freeware/ ... urce.shtml

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: keep/maintain the aspect ratio of Movie player ?
PostPosted: Mon Apr 09, 2012 1:54 am 
Offline

Joined: Mon Jan 16, 2012 8:08 am
Posts: 161
Location: India
Hi MonkeybreadSoftware,
Then which plugin is needed.Could you please tell me ?

Thanks
Bimal.


Top
 Profile  
Reply with quote  
 Post subject: Re: keep/maintain the aspect ratio of Movie player ?
PostPosted: Mon Apr 09, 2012 3:39 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
No plugin needed. Just some lines like this:

dim faktor as Double = min( Height / Pic.Height, Width / Pic.Width)

// Calculate new size
dim w as integer = Pic.Width * faktor
dim h as integer = Pic.Height * faktor

Gruß
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: keep/maintain the aspect ratio of Movie player ?
PostPosted: Mon Apr 09, 2012 5:19 am 
Offline

Joined: Mon Jan 16, 2012 8:08 am
Posts: 161
Location: India
Hi MonkeybreadSoftware,
Thanks for responding me.What ever you are telling that code is for a picture but that is not for a Movie File. Because we can not assign the new height and width to the movie file.Then how i will change the height and width of the Movie file.

Quote:
dim faktor as Double = min( Height / MovieName.MovieHeight, Width / MovieName.MovieWidth)

// Calculate new size
dim w as integer = MovieName.Width * faktor

dim h as integer = MovieName.Height * faktor

After that how i will assign the value to a Movie class. Please tell me .


Thanks
Bimal


Top
 Profile  
Reply with quote  
 Post subject: Re: keep/maintain the aspect ratio of Movie player ?
PostPosted: Mon Apr 09, 2012 5:25 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
I expect you do some transitional work here, by replacing pic.height/pic.width with movie.BaseMovieWidth/movie.BaseMovieHeight.
And also when you assign them, assign them to movie player.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: keep/maintain the aspect ratio of Movie player ?
PostPosted: Mon Apr 09, 2012 6:46 am 
Offline

Joined: Mon Jan 16, 2012 8:08 am
Posts: 161
Location: India
Hi MonkeybreadSoftware,
Thanks for your Reply.What you told me for last time that is right but i do not want to decrease the width and height of the Media player.

Thanks
Bimal.


Top
 Profile  
Reply with quote  
 Post subject: Re: keep/maintain the aspect ratio of Movie player ?
PostPosted: Mon Apr 09, 2012 7:02 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
Who says something about decrease?

You scale the size of the movie to the size of the we area in the window where you want to have the movie player.

I can't tell you exact code. I can only point you to documentation and similar samples.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: keep/maintain the aspect ratio of Movie player ?
PostPosted: Mon Apr 09, 2012 7:31 am 
Offline

Joined: Mon Jan 16, 2012 8:08 am
Posts: 161
Location: India
Hi MonkeybreadSoftware,
Thanks for your reply.

Thanks
Bimal


Top
 Profile  
Reply with quote  
 Post subject: Re: keep/maintain the aspect ratio of Movie player ?
PostPosted: Mon Apr 09, 2012 8:18 am 
Offline

Joined: Tue Dec 27, 2011 8:54 am
Posts: 139
Location: India
Hi,

Dim m as Movie
dim f as FolderItem= GetRootFolder.Child("MovieFiles").child("SelectedFileName.Mov")

m=f.OpenasMovie

dim Faktor as Double = min( OrgMovieHeight /m.BaseMovieHeight, OrgMovieWidth / m.BaseMovieWidth )

MoviePlayerDevice.Height = m.BaseMovieHeight * Faktor
MoviePlayerDevice.Width = m.BaseMovieWidth * Faktor
MoviePlayerDevice.AutoPlay = True
MoviePlayerDevice.border=True
MoviePlayerDevice.movie=m


This is the above code i added for get the scale Faktor . But it is not working.

Another way to maintain the aspect ratio :

dim fff as double
dim s as screen
dim w,h,xx,yy as integer
Dim m as Movie

try

dim f as FolderItem= GetRootFolder.Child("MovieFiles").child("SelectedFileName.mov")
m=f.OpenasMovie

fff=min(MoviePlayerDevice.Height/(m.baseMovieHeight+16),MoviePlayerDevice.Width/m.baseMovieWidth)

w=m.baseMoviewidth*fff
h=m.baseMovieHeight*fff
xx=(MoviePlayerDevice.Width -w)/2
yy=(MoviePlayerDevice.Height-h)/2

if xx<16 then
xx=0
end if

//MoviePlayerDevice.left=xx
//MoviePlayerDevice.top=yy
MoviePlayerDevice.width=w
MoviePlayerDevice.height=h
MoviePlayerDevice.movie=m
MoviePlayerDevice.play



My objective is like : I do not want to change the width and height of the movie player. I just keep maintain the aspect ratio of the movie files (Any size of the movie files) inside the movie player.

Please help me out ?

Thanks,
Prakash

_________________
PK Pothal
Software Developer in REAL STUDIO 2011r4.3, ASP.NET, VB.NET, C# AND SQL SERVER 2005/08
OS:WINDOWS N MAC


Top
 Profile  
Reply with quote  
 Post subject: Re: keep/maintain the aspect ratio of Movie player ?
PostPosted: Mon Apr 09, 2012 10:23 am 
Offline
Site Admin
User avatar

Joined: Tue May 06, 2008 1:07 pm
Posts: 1464
Location: NotEvenOnTheMap, CT
No, you should not apply the ratio (factor) uniformly. That will just scale the video down uniformly, but not necessarily to the space you want to fill.

Let's say you have a 1600x900 video you want to fit into a 640x480 space, while respecting the aspect ratio. First, you need the ratio of the video, which is height over width. In this case, 0.5625. To fit the video into 640 pixels wide, multiply 640 by 0.5625 to equal 360 pixels. Your video should be 640x360 to fit into a 640x480 player. If the ratio is greater than 1, then the video is taller than it wide. In that case, divide the height of the space by the ratio to determine the width of the video. So a 900x1600 video would have a ratio of 1.7777, and a fit size of 270x480.

Here's some pseudo code.

Const PlayerWidth = 640
Const PlayerHeight = 480
Const VideoWidth = 1600
Const VideoHeight = 900

Dim Ratio As Double = VideoHeight / VideoWidth
Dim FitWidth,FitHeight As Integer
If Ratio <= 1 Then
FitWidth = PlayerWidth
FitHeight = PlayerWidth * Ratio
Else
FitWidth = PlayerHeight / Ratio
FitHeight = PlayerHeight
End If

_________________
Thom McGrath - @tekcor
Web Framework Architect, Real Software, Inc.


Top
 Profile  
Reply with quote  
 Post subject: Re: keep/maintain the aspect ratio of Movie player ?
PostPosted: Tue Apr 10, 2012 2:48 am 
Offline

Joined: Tue Dec 27, 2011 8:54 am
Posts: 139
Location: India
Hi Thom,

Thanks for replying my question.

I have few doubt on this :
1# where i will set the "FitWidth" and "FitHeight" ?
For now i assigned that size to movie player. I added this code in a listbox "cellClick" event because on the basic of listbox items, different types of movie files are play in the Movie player.

please have a look into the below lines of code :
Dim m as Movie
dim f as FolderItem= GetRootFolder.Child("MovieFiles").child("File.mov")
m=f.OpenasMovie

dim VideoWidth as Integer = 0
dim VideoHeight As Integer = 0

Const PlayerWidth = 462
Const PlayerHeight = 567
VideoWidth = m.BaseMovieWidth
VideoHeight =m.BaseMovieHeight

Dim Ratio As Double = VideoHeight / VideoWidth
Dim FitWidth,FitHeight As Integer

If Ratio <= 1 Then
FitWidth = PlayerWidth
FitHeight = PlayerWidth * Ratio
Else
FitWidth = PlayerHeight / Ratio
FitHeight = PlayerHeight
End If

MoviePlayerDevice.AutoPlay = False
MoviePlayerDevice.width=FitWidth
MoviePlayerDevice.height=FitHeight
MoviePlayerDevice.movie=m
MoviePlayerDevice.play


2# When i hit the Restore or Maximize button in the application Bar, then the movie file size is squeezed.
3# Is there any options for make the Movie player center align in the application.

Can you please tell me how to handle that one ?

Thanks,
Prakash

_________________
PK Pothal
Software Developer in REAL STUDIO 2011r4.3, ASP.NET, VB.NET, C# AND SQL SERVER 2005/08
OS:WINDOWS N MAC


Top
 Profile  
Reply with quote  
 Post subject: Re: keep/maintain the aspect ratio of Movie player ?
PostPosted: Tue Apr 10, 2012 8:33 am 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:48 am
Posts: 3554
Location: Lenexa, KS
I think you need to do some actual work in figuring out how to code. We can't code it for you.

_________________
Bob K.

A blog about being a Real Studio/Xojo developer at http://www.bkeeneybriefs.com


Top
 Profile  
Reply with quote  
 Post subject: Re: keep/maintain the aspect ratio of Movie player ?
PostPosted: Wed Apr 11, 2012 1:35 am 
Offline

Joined: Tue Dec 27, 2011 8:54 am
Posts: 139
Location: India
Hi Bob,

Yes you are right. i am doing coding for myself.

I have already try with 3 different type of ways to keep the aspect ratio of the movie file when running in a movie player with different screen resolutions and also different monitor size. but still i am unable to find a best solutions.

Thanks all for your time.

Thanks,
Prakash

_________________
PK Pothal
Software Developer in REAL STUDIO 2011r4.3, ASP.NET, VB.NET, C# AND SQL SERVER 2005/08
OS:WINDOWS N MAC


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group