How to mute Webbrowser in Windows Forms Application? - winforms

What we have:
An System.Windows.Forms.Webbrowser where we run an video.
We'd like to mute the Webbrowser WITHOUT muting the whole application.
Is there any way like webbrowser.mute() ?

If the video is an HTML5 video and you really only want to mute the video, it is actually pretty straight-forward. You just get the element and set it's attribute.
var video = webBrowser1.Document.GetElementById("video1");
video.SetAttribute("muted", "true");

Related

How to play audio in iOS in background?

My goal is to make iOS play audio in a background.
When the audio is received by iPhone, it's not played unless I open the app in the foreground.
Basically, the iPhone is "waiting" when I click to open the app, and then it plays the audio.
Following Developer Guide, I added ios.background_modes=music to my .properties file.
However, nothing changed in behaviour.
I receive audio in real time via websocket class (onMessage(byte[] message) method).
What approach would you suggest in order to resolve this issue and make iOS play audio in a background?
This is the syntax for adding via the GUI not editing the properties file directly. You need to add the property with a codename1.arg. prefix.
Specifically: codename1.arg.ios.background_modes=music

Youtube video keeps playing until app is closed

Some questions for playing youtube videos in webBrowser component.
I played youtube video in webBrowser component. But it keeps playing when the form is backed as well. It only stops playing when the app is removed. I tried webBrowser.stop() and webBrowser.destroy() method etc in the back command but with no success.
String getVideoUrl = "https://www.youtube.com/embed/" + videoId + "?autoplay=1";
WebBrowser player = new WebBrowser();
player.setURL(getVideoUrl);
f.addComponent(BorderLayout.CENTER, player);
However webBrowser.reload() solves the problem on android phones but not on Android Tablets.
While viewing the video, if the mobile is set to sleep by the user, the display goes out while watching the video. So how to disable the sleep mode?
Mobile screen display out problem.
When the video completes, the youtube video gives video link of the related videos & they can be played too, how can I disable that. I don't want to make other videos play from the app
The video doesn't play in android icecream sandwich and below.
Try: webBrowser.setPage("<html><head></head><body></body></html>", null);
You can use Display.getInstance().setScreenSaverEnabled(false);.
That's a setting on youtube for embedded links. You can select to disallow it.
That's a limitation of the html embed code from google. Not much we can do here.

DRM photo viewing in Silverlight?

I would like to write an enterpise app that displays some slides on the PC (think powerpoint deck)
important is the requirement that the user cannot take a screenshot of the picture, to see the image they must enter a password, I do not want them to be able to keep the picture
is this possible in Silverlight? what about Flash?
thanks!
You mean, how do you disable someone from using [Ctrl - Print Screen] on a PC or [Command-Shift-3] on a Mac?
Ummm... I think the best you could do is create and out of browser app that is fullscreen AND only when it becomes the active window, it will show the images you want to protect. That way you can disable the keys for screen capture and prevent any other programs from capturing a window shot of your what is in your app.
Still, there is nothing preventing a fiddler user from capturing an image downloaded to your app from a webservice or something. All the images would have to be encrypted then decrypted by your app.
Looks like watermarking your images is your best bet.

Showing the result of a WebClient-postback in an Browser Window from Silverlight 4

I want to show the result of a WebClient-Postback in an new Browser-Popup-Window. As the "Navigate" and "Popup" methods of HtmlPage only support Get-requests, I issued an POST-request to an REST-Service via WebClient. But now I want to show the result (e.g. application/ms-excel or application/pdf) in an new Browser-Window.
Therefore, can I open an new BrowserWindow and set its contents as well as some corresponding http-headers with on-board means of Silverlight 4? Or even better, is an easier way to trigger the browser to do the POST-request to the service?
Best Regards
I tried going this route but the WebBrowser control is not opened to the developer. What I did as a temporary workaround was to open my webpage http://www.xyz.com/default.aspx inside the WebControl and let the page drive the rest.
Mike Taulty had an example for somthing like this, how you can use javascript to communicate back to the silverlight app through InvokeScript:
http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2009/11/18/silverlight-4-rough-notes-html-hosting-in-the-webbrowser-control.aspx
I hope it helps!

How to play youtube vidoes in silverlight(in browser)?

I want to develop an silverlight application which plays youtube videos. I dont want to let users install my silverlight application on thri PCs, so I would need to play the videos in browser. Is there anyway we can achieve this?
Silverlight 4 comes with a new WebBrowser control which lets you display HTML content (e.g. an iframe with youtube in it). Unfortunately, that control will work in Out-Of-Browser mode only. So if you don't want users to install your app on their PCs, that won't be an option for you.
So the only ways I see to work around that problem are
A) Open a popup (new browser window) which shows youtube content.
B) Use JavaScript to open a new div/iframe on top of your Silverlight app which shows youtube. You will have to enable the so-called windowless mode for your Silverlight app then (otherwise, you won't be able to display any kind of HTML on top of your app).
Cheers, Alex

Resources