|
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
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,225
|
Hi, You need to enable proprietary video/audio codecs in order to play MP4: https://www.essentialobjects.com/doc/webbrowser/advanced/html5.aspxThanks!
|
|
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!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,225
|
Where do you apply eoOptions?
|
|
Rank: Newbie Groups: Member
Joined: 8/17/2017 Posts: 5
|
Right after the call to InitializeComponent() (see code above...) thx!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,225
|
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?
|
|
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!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,225
|
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.
|
|
Rank: Newbie Groups: Member
Joined: 8/17/2017 Posts: 5
|
thanks much - just what i needed!!
|
|