It is currently Thu Aug 22, 2019 2:20 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: HTML5 MP4 Player
PostPosted: Sat Aug 12, 2017 9:12 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1572
-----------------------------------------------------------------------------------

Download HTML5 MP4 Player from My PureBasic Stuff

-----------------------------------------------------------------------------------

Tricks 'n' Tips
PureBasic Interface to OpenCV
PureBasic Interface to WinDivert
PureBasic Interface to WinRAR
PureBasic Interface to 7-Zip
PureBasic Interface to ImDisk
Windows Services & Other Stuff
Invading Space Aliens
Death Star vs Asteroids
GIF Toolkit
LSB File Embedding
Spider Web Drawing
Deform Image: MLS
Video Snipping Tool
Image Waves: LUT
HTML5 YouTube Player
HTML5 MP4 Player
Barcode Generator
Embed JS into PureBasic
Geolocation: Google Maps
Book & Viewer & Magnify
Video for Windows: VfW
Alternate Console
Network Share Management

-----------------------------------------------------------------------------------

FEATURES
- resizable window
- full screen mode
- save video downloaded from URL
- save snapshot of current frame
- numerous command parameters

Player Window:
- F1 Key: Toggle Shortcut Menu
- F2 Key: Open MP4 File (path or URL)

- F3 Key: Open Thumbnail Viewer
- F4 Key: Save Video Frame

- F12 Key: Reload Default Video

- Esc Key: Exit Full Screen / Close Window

Command Parameters
- MP4 || MP4Video : set a start video when the player is opened
- M || Maximized : open the window maximzed (DEFAULT: 0 || 1)
- X : open the window at x location
- Y : open the window at y location
- W || Width : set the starting window width
- H || Height : set the starting window height
- MW || MinWidth : set the minimum window width
- MH || MinHeight : set the minimum window height
- FS || FullScreen : open the window in full screen (DEFAULT: 0 || 1)
- FSX || FullScreenX : open the window in full screen at x location
- FSY || FullScreenY : open the window in full screen at y location
- FSW || FullScreenWidth : set the full screen width
- FSH || FullScreenHeight : set the full screen height
- AS || AutoStart : attempt to start the video without user interaction (DEFAULT: 1 || 0)
- LV || LoopVideo : restart the video after it completes (DEFAULT: 1 || 0)
- SV || SaveVideo : save the video downloaded from a URL (DEFAULT: 1 || 0)
- PO || PlayerOnly : play the video without first fully downloading (DEFAULT: 0 || 1)
- TR || ThumbnailRatio : set the thumbnail save-size ratio (DEFAULT: 0.25 || 0.25 - 1)

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Thu Jun 06, 2019 7:04 am, edited 35 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: MP4 Player
PostPosted: Sun Aug 13, 2017 9:48 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1572
This is a companion program to the YouTube Player.
- also updated at the time of this post

Press the [ F4 ] key to save a snapshot of the current frame.

If the thumbnail viewer is open [ F3 ], pressing the [ F4 ] key will create an on-screen thumbnail list, and save a snapshot of the current frame.

-----------------------------------------------------------------------

Updated:
- added Shortcut keys
-- see [ F1 ] Shortcut Menu for changes
- the MP4 player Full Screen icon now controls the PureBasic window
-- double-clicking the window also toggles the Full Screen display on / off

NB*: Included a JavaScript event listener and function that can react to changes to the document title.
- document title can be changed from PureBasic using (DOM) existing code

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Sat Aug 26, 2017 1:40 am, edited 4 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: MP4 Player
PostPosted: Sun Aug 13, 2017 10:03 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jan 22, 2009 3:48 am
Posts: 595
Location: china
can't Download.

_________________
my pb for chinese:
http://ataorj.ys168.com


Top
 Profile  
Reply with quote  
 Post subject: Re: MP4 Player
PostPosted: Mon Aug 14, 2017 7:53 am 
Offline
Addict
Addict
User avatar

Joined: Wed Apr 30, 2003 8:15 am
Posts: 981
Location: Germany
Well done! Thx JHPJHP

_________________
"Daddy, I'll run faster, then it is not so far..."


Top
 Profile  
Reply with quote  
 Post subject: Re: MP4 Player
PostPosted: Wed Aug 16, 2017 5:38 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1572
Hi dige,

Thank you for the kudos :!:

----------------------------------------------

Figured out the Same-Origin policy for locally loaded MP4 files (does not apply to URLs).

Updated:
- switch around some Shortcut keys (see the [ F1 ] menu for changes)
-- press the [ F3 ] key to open the thumbnail viewer
-- press the [ F4 ] key to save a snapshot of the current frame

If the thumbnail viewer is not open and the [ F4 ] key is pressed, a full snapshot is saved (also works with URLs).
- this uses an API hack, while the thumbnail snapshot solution should work in a cross-platform application

NOTE: While the Shortcut Menu and Thumbnail List cannot be viewed in Full Screen, there is a simple fix, but it would require writing custom controls.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Sat Aug 26, 2017 1:41 am, edited 4 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: MP4 Player
PostPosted: Wed Aug 16, 2017 6:53 am 
Offline
User
User
User avatar

Joined: Wed Mar 15, 2006 9:40 am
Posts: 98
Location: Germany
Fine!
Thank you.
But it looks like it don't like special characters (i.e. ä, ö, ü, ß) in filenames.

_________________
Please pardon my English, my native tongue is German.


Top
 Profile  
Reply with quote  
 Post subject: Re: MP4 Player
PostPosted: Thu Aug 17, 2017 12:37 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1572
Hi uweb,

Thank you for the information; problem fixed.
- included the following MIME Type: <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>

----------------------------------------------------

Updated:
- added a new Command Parameter
-- ThumbnailRatio / TR (default: 0.25)

NOTE: The PureBasic WebGadget supports using the <video> element with MP4 files.
- if the file is loaded locally, the Same Origin Policy can be bypassed
-- available JavaScript Functions: toBlob(), toDataURL(), and getImageData()

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Sun Aug 20, 2017 3:03 am, edited 4 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: MP4 Player
PostPosted: Sat Aug 19, 2017 2:03 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1572
Cross-Origin Resource Sharing (CORS) now available for both locally loaded MP4 files and URLs.

Updated:
- expanded the snapshot Procedure (third party API)
- added a Splash window
- added a Load window (replaced OpenFileRequester)
- added URL load progress to the Titlebar and Taskbar button
- applied some code improvements and bug fixes

NOTES:
- press the [ F1 ] key to open the Shortcut Keys Menu
- press the [ F2 ] key to load an MP4 file
- press the [ F3 ] key to open the Thumbnail Viewer
- press the [ F4 ] key to save frames
-- image size is configurable (defaulted to 25% of original video size)
-- if the Thumbnail Viewer is not open, frames are still saved, but thumbnails are not added to the viewer
- enter Full Screen from the onboard controls (includes a zoom button if black bars are visible)
- the Shortcut Keys Menu and the Thumbnail Viewer cannot be opened in Full Screen

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Thu Aug 24, 2017 12:25 am, edited 4 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: MP4 Player
PostPosted: Sat Aug 26, 2017 3:41 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1572
Updated:
- added 2 Command Parameters
-- SaveVideo (default #True)
-- PlayerOnly (default #False)
- fixed the Save Snapshot feature for local videos
- applied a few code improvements

SaveVideo:
When a video is downloaded from a URL it will auto-save to the local drive. A URL with a video of the same name will be ignored, and the local video will be played instead.
- this setting is ignored if the video file is greater then 250MB
- this setting is ignored when the PlayerOnly option is enabled

PlayerOnly:
Enabling this option will disable the Thumbnail Viewer and Save Snapshot feature, but loading videos from the internet will play without first having to be fully downloaded.

NB*: The YouTube Player was also updated.

--------------------------------------------------------------------------------

Update Reposted:
- added a Progressbar when downloading from a URL
- squashed some bugs

I don't think anyone will use this as an MP4 player, but the techniques used to communicate between PureBasic and JavaScript via the WebGadget, should put to rest most concerns that the WebGadget is obsolete. Quite the opposite, IMHO it is the most powerful Gadget PureBasic has to offer.
- Embed JS into PureBasic, Geolocation: Google Maps, YouTube Player, MP4 Player, Barcode Generator

NB*: Previous update would crash the program when loading non-playable MP4 files.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
 Post subject: Re: MP4 Player
PostPosted: Sat Aug 26, 2017 9:23 am 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 5830
Location: Wales, UK
I am sure people will use it, it's an excellent Player JHPJHP.
You have coded some very nice features throughout, making it a good tutorial too. 8)

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
Reply with quote  
 Post subject: Re: MP4 Player
PostPosted: Tue Aug 29, 2017 5:21 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1572
Hi IdeasVacuum,

Providing examples as learning tools was one of the main reasons I started posting code to the PureBasic forum.

Thank you for your kind words.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
 Post subject: Re: HTML5 MP4 Player
PostPosted: Thu Jan 03, 2019 3:54 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1572
Updated:
- squashed a bug

I noticed a problem a couple weeks ago where a video was downloaded, but the player reported it as an unsupported format.

Until I had time to look at the issue and to avoid disabling the download link, I included a copy of the online video into the download package. This bypassed the problem by playing the local copy, but increased the download size by over 20 MB.

NB*: The problem occurred because I was removing the download reference (revokeObjectURL) before the player had time to use it.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
 Post subject: Re: HTML5 MP4 Player
PostPosted: Thu May 23, 2019 5:38 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1572
Updated:
- made a couple small changes to the code

NOTE: Make sure to check out the Thumbnail Viewer [ F3 ]; save snapshots of the current frame [ F4 ].

NB*: Press [ F1 ] to see all the available options (i.e. COMMAND PARAMETERS: ThumbnailRatio).

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


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:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye