Can't play videos with webbrowser control - c#

I have a webbrowsercontrol and I want to play videos from youtube and vimeo.
At first I couldn't even load youtube.com and it was saying that I had to eneble javascript, so I did and I added this IsScriptEnabled="True" property in <phone:WebBrowser/> and then the page loaded, But when I press on a video to play it says "video not available" on youtube, and "your phone can't play this video" on dailymotion.
I used this code:
VideoStream.Navigate(new Uri("http://www.dailymotion.com/", UriKind.Absolute));

I'm not sure about the exact problem but i think it's flash related. I had the same problem when I used WebBrowser.
If noone else has a better solution you could at least use this solution for youtube videos:
a video link ends like this: watch?v=XXXXX
just add &html5=1 to enforce html5 video playback. --> watch?v=XXXXX&html5=1
If you want to only show the video: --> https://www.youtube.com/embed/XXXX?&autoplay=1&rel=0&html5=1

As far as I know, if the Internet explorer in your machine can play the flash video, then the “WebBrowser” control in .Net framework can also do this, so please make sure the IE in your machine works fine with the flash ActiveX control.

Related

Watching full-screen videos using C# Web Browser

I'm currently working with Visual Studio and Windows Forms. I want to be able to watch full-screen videos from sources such as Youtube and Vimeo.
I am attempting to do this with a Web Browser but I get issues where the web browser opens YouTube and attempts to download something and Vimeo reports that there could be an issue and refuses to play the video. I already know the URL's of each video as they are responses to inputs.
What would be the best way to watch videos using a Windows Form?
At the moment I am currently just using;
webBrowser1.Navigate("http://www.youtube.com")
You need to embed the video on a web browser control...
check out the following thread on MSDN
I was plagued with the issue that my browser did not support HTML5, although I had IE 11 installed and it did not go away.
I found that using a Shockwave Flash Object was the best method to display movies/youtube videos. I simply added the component to the form and entered the desired movie and worked as intended, I'll use web browsers for non-media content.

How Play YouTube video in webBrowser control?

Is there a way to play YouTube video in webBrowser control? Because when i tap on watch video nothing happens...
Thanks!
As far as I know Windows Phone 7 does not support Flash yet.
Take a look at this:
http://answers.microsoft.com/en-us/winphone/forum/wp7-wpdevices/will-windows-phone-7-play-you-tube-and-flash/29c69dc1-658f-4729-b24d-67b46a4138d2

play youtube music in application

Does anyone know how to play music from youtube in my c# .net 4.0 app ? I've installed all the apis and sdks from google but i can't seem to find a tutorial that lets me play music in my desktop app .
regards,
Alexandru Badescu
If it's an asp.net application, you can just embed an object tag in your markup. Check out the "<embed>" button to get the tag info for an individual video.
If it's a Windows Forms or WPF desktop application, why not just embed a browser control with the same tag?
Either way, you should be able to just make the object tag invisible and still be able to hear the music.
Here's a tutorial on how to put youtube videos into an MVC app it should help.
http://webpangea.blogspot.com/2009/12/youtube-ms-mvc-and-jquery.html

How to play a audio sound in a web page as a background music

I want to play an audio file whenever my page gets loaded onto the client browser. And if a user presses a pause button on the web page then the sound gets paused until he leaves the sound and can resume as well. ?
Here's some examples. But as some said before, its not the best idea to have sound. But if yo do at least have a toggle to mute, turn the volume down or disable it totally.
The easy musicplayer for flash is a easy-to-set up MP3 player solution that does what you need. It provides "play" and "pause" buttons.
Until HTML 5, flash is going to be your best solution, this is mostly because it's an intrusion to have a page commandeer control of the user's speakers, and thus why people have recommended not doing this at all or making it so that the user must explicitly click something.
Here's a page with some freebie flash player options:
http://www.premiumbeat.com/flash_resources/free_flash_music_player/
I found this web site helpful for setting up a sound file from within a page. In my case, I only wanted it to play if they clicked something. I would agree with others here who suggested that.
This web site
http://www.phon.ucl.ac.uk/home/mark/audio/play.htm
One problem I have is when I have a number of web pages open and one of them starts making a sound, it is very difficult to find the page to get it to shut up. It is better to have the user launch the sound.
I guess achieving the same with jquery plugins won't be less exciting!
The jquery mediaplayer does the same. Using this jquery plugin, you can play your media player files without the need of windows media player. The limitation is that this works only with the media player type of files.
Further, since mp3 files are highly used in web pages, we could use the bssound jquery plugin to embed mp3 file in our web page.

ASP.NET video and audio handler

I am using ASP.NET's "handler" to show images in an application. I need to play files of audio and video like I do with the image: I recover it from database and show it on an aspx page. Can I create a "handler" for the video and the audio? I don't want that a dialog box is opened asking to the user if he wants to play or save the video file.
I want to play it like YouTube does.
Maybe I can use silverlight for that.
Thank you!
It consists of two parts.
A handler or something that streams the video under the hood.
A client (can be implemented in Silverlight or Flash) that's on an standard HTML page that fetches the video from the handler and displays it.
It's certainly possible to write a handler that pulls video/audio content out of a database and streams it to the client. That would work much the same was as your existing image one.
The way to stop the dialog is to present your video within a video viewing control on the web page. For example, a silverlight control with a MediaElement in it.
Check out this guide to writing a silverlight media player: http://www.learn-silverlight-tutorial.com/StreamingMediaUsingSilverlight.cfm
This won't necessarily be the most performant way of serving video content, if you want lots of performance, look into buying commercial media streaming solution that can be integrated with your site.

Categories