Welcome Guest Search | Active Topics | Sign In | Register

How to play .mp4 in TabbedBrowser example? Options
mdd
Posted: Thursday, August 17, 2017 5:53:37 PM
Rank: Newbie
Groups: Member

Joined: 8/17/2017
Posts: 5
I am working with your example TabbedBrowser_CS

I am trying to get it to load\play a media file; in my initial attempts i'm trying to load\play
file://c:/temp/myvid.mp4

I've tried typing file://c:/temp/myvid.mp4 into the address bar, as well as c:\temp\myvid.mp4

I've installed the Adobe flash plugin that you mention in the 'HTML 5 Support' section of the help file.

I have also added the following code into the TabbedBrowser_CS project:

// added this code

public MainWindow()
{
InitializeComponent();

// Want to play .mp4 file. I typed: file://c:/temp/myvid.mp4 into the
// address bar. Also tried c:\temp\myvid.mp4
// Set these options - but this does not seem to help tho...
// --------------------------------------------------------------------
EO.WebEngine.EngineOptions eoptions = new EO.WebEngine.EngineOptions();
eoptions.AllowProprietaryMediaFormats();

EO.WebEngine.BrowserOptions options = new EO.WebEngine.BrowserOptions();
options.AllowJavaScript = true;
options.LoadImages = true;
options.AllowJavaScriptOpenWindow = true;
options.AllowPlugins = true;
options.EnableWebSecurity = false;

eoptions.SetDefaultBrowserOptions(options);
// --------------------------------------------------------------------

}

// added handlers

page.WebView.CertificateError += new CertificateErrorHandler(WebView_CertificateError);
page.WebView.DownloadCompleted += new DownloadEventHandler(WebView_DownloadCompleted);
page.WebView.LoadFailed += new LoadFailedEventHandler(WebView_LoadFailed);


// added this code

void WebView_DownloadCanceled(object sender, DownloadEventArgs e)
{
m_Downloads.Remove(e.Item);
}

void WebView_DownloadCompleted(object sender, DownloadEventArgs e)
{
// tried this too, but this just seems to throw
// things into a loop - constantly re-downloading the file

// m_CurPage.WebView.Url = e.Item.FullPath.ToString();
}

void WebView_LoadFailed(object sender, LoadFailedEventArgs e)
{
e.UseDefaultMessage();
}


I can't get this to play the .mp4 file; it just displays an empty browser, and pops
open the 'downloads' pane.

What am I missing??

thx much for your help!

Win 7 64bit; VS Ent 2015 update 3
eo_support
Posted: Thursday, August 17, 2017 5:55:39 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
Hi,

You need to enable proprietary video/audio codecs in order to play MP4:

https://www.essentialobjects.com/doc/webbrowser/advanced/html5.aspx

Thanks!
mdd
Posted: Thursday, August 17, 2017 6:55:12 PM
Rank: Newbie
Groups: Member

Joined: 8/17/2017
Posts: 5
I thought I took care of that with this:

EO.WebEngine.EngineOptions eoptions = new EO.WebEngine.EngineOptions();
eoptions.AllowProprietaryMediaFormats();

EO.WebEngine.BrowserOptions options = new EO.WebEngine.BrowserOptions();
options.AllowJavaScript = true;
options.LoadImages = true;
options.AllowJavaScriptOpenWindow = true;
options.AllowPlugins = true;
options.EnableWebSecurity = false;

I set the AllowProprietaryMediaFormats, and set EnableWebSecurity as well.

Is there more I need to do to enable this? thx!
eo_support
Posted: Thursday, August 17, 2017 7:23:40 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
Where do you apply eoOptions?
mdd
Posted: Thursday, August 17, 2017 7:30:45 PM
Rank: Newbie
Groups: Member

Joined: 8/17/2017
Posts: 5
Right after the call to InitializeComponent()
(see code above...)
thx!
eo_support
Posted: Thursday, August 17, 2017 7:40:06 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
In your code I see that you created a new EO.WebEngine.EngineOptions object (eoOptions), then you modified this object (by calling AllowProprietaryMediaFormats and SetDefaultBrowserOptions). So now you have this eoOptions object in memory, but where do you use this object?
mdd
Posted: Thursday, August 17, 2017 8:09:06 PM
Rank: Newbie
Groups: Member

Joined: 8/17/2017
Posts: 5
ah - we're on to something! How do i set the default\current EngineOptions ? That sounds like the piece i'm missing. do i just remove the 'new' from this? thx again!
eo_support
Posted: Thursday, August 17, 2017 8:51:35 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
Take a look of the source code inside Application_Startup in App.cs.xaml. It sets RemoteDebugPort and RegisterCustomSchemes on the default engine option. Add your code there and everything should work.
mdd
Posted: Friday, August 18, 2017 3:10:43 PM
Rank: Newbie
Groups: Member

Joined: 8/17/2017
Posts: 5
thanks much - just what i needed!!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.