WPF MediaElement play http url and storage problem - c#

I'm having a MediaElement playing a google drive link like so
xaml code:
<MediaElement x:Name="MdPlayer"
MaxHeight="350"
MaxWidth="350"
Margin="5">
</MediaElement>
.cs code:
MdPlyr.Source = new Uri(#"http://drive.google.com/uc?export=download&id=1jWhVXnC9ziy5jNZeDpcJpTUGrAcF4fNf");// It's actually runbable
When I access to the link on web browser, it download the file, while playing it with MediaElement I didn't have to download it at all. I wonder if the file is downloaded and stored somewhere in the background or is it streamed directly on google drive. Is there any keyword so that I can look into this kind of things?

Related

how can i play VLC live streaming video in asp.net application using HTML video Tag

I setup a live stream of the VLC Media player using Http and I want this stream to be played in my asp.net application using HTML 5 Video tag.
I expect to play the live stream of the VLC in my asp.net application.
First You need to supply the MIME type attribute in the video tag:
type="application/x-mpegURL". The video tag I use for a stream looks
like this.
<video width="352" height="198" controls>
<source src="VLCLiveStreamingURLGoesHere" type="application/x-mpegURL">
</video>
Make sure to replace VLCLiveStreamingURLGoesHere with your VLC Live stream URL.
If you want to play direct HLS file, then add chrome extension called Native HLS Playback from chrome web app.
A possible alternative for that:
Use an encoder (e.g. VLC or FFmpeg) into packetize your input stream
to OGG format. For example, in this case I used VLC to packetize
screen capture device with this code:
C:\Program Files\VideoLAN\VLC\vlc.exe -I dummy screen://
:screen-fps=16.000000 :screen-caching=100
:sout=#transcode{vcodec=theo,vb=800,scale=1,width=600,height=480,acodec=mp3}:http{mux=ogg,dst=127.0.0.1:8080/desktop.ogg}
:no-sout-rtp-sap :no-sout-standard-sap :ttl=1 :sout-keep
Embed this code into a tag in your HTML page like that:
This should do the trick. However it's kind of poor performance and
AFAIK MP4 container type should have a better support among browsers
than OGG.
HTML5 live streaming

Get URL of image in OneDrive

I'm using LiveSDK in C#. Is there any way to get an URL (for example, url like this: https://onedrive.live.com/embed?cid=1ED5694B634A1579&resid=1ED5694B634A1579%21685&authkey=ANQwPScWiCxbILY) for a specified image file in order to put this link directly to the Image (Source property) control?
I dont want to download a Stream from OneDrive file, set it to a BitmapImage and put it to the Image control.
I know that OneDrive web app allows to create an URL for a selected file, but don't know if the SDK has such feature.
There is a very good example in MSDN Samples Page showing how to pull and use images from OneDrive.
Photo Sky SampleThis sample demonstrates how to use the LiveSDK for pulling images from SkyDrive. In this sample you will learn how to use LiveSDK and request consent from the user to access his SkyDrive files and display the images in a Metro style application.
Source: PhotoSky - SkyDrive Sample

XAMARIN - add video from youtube

i search information how to add video from youtube, example:
I want add video from some youtube link.
I think that it should be in webview, but i need some details, because i can't find any information about my problem.
You can use the webview to play youtube video.
string html=#"<html><body><iframe width=""200"" height=""400"" src=""strUrl""></iframe></body></html>";
var myWebView = ( WebView ) FindViewById ( Resource.Id.myWebView );
var settings=myWebView.Settings;
settings.JavaScriptEnabled=true;
settings.UseWideViewPort=true;
settings.LoadWithOverviewMode=true;
settings.JavaScriptCanOpenWindowsAutomatically=true;
settings.DomStorageEnabled=true;
settings.SetRenderPriority(WebSettings.RenderPriority.High);
settings.BuiltInZoomControls = false;
settings.JavaScriptCanOpenWindowsAutomatically=true;
myWebView.SetWebChromeClient(new WebChromeClient());
settings.AllowFileAccess = true;
settings.SetPluginState(WebSettings.PluginState.On);
myWebView.LoadDataWithBaseURL(null,html,"text/html","UTF-8",null);
Add internet permission in manifest file and enable hardwareAccelerated="true". Follow this my blog entry for more detail : http://appliedcodelog.blogspot.in/2015/09/how-to-play-youtube-video-using-webview.html
Update: Everything below is still correct, but the official YouTube API for Android is now available.
By far, the easiest way to play a YouTube video on Android is to simply fire an Intent to launch the native Android YouTube app. Of course, this will fail if you are not on a certified Google device, that doesn't have the complement of Google apps. (The Kindle Fire is probably the biggest example of such a device). The problem with this approach is that the user will not automatically wind up back at your app when the video finishes; they have to press the Back button, and at this point you've probably lost them.
As a second option, you can use the MediaPlayer API to play YouTube videos. But there are three caveats with this approach:
1) You need to make a call to YouTube's GData webservice API, passing it the ID of the video. You'll get back a ton of metadata, along with it the RTSP URL that you should pass to MediaPlayer to play back an H.264-encoded stream. This is probably the reason why your attempt to use MediaPlayer failed; you probably weren't using the correct URL to stream.
2) The GData/MediaPlayer approach will only play back low-resolution content (176x144 or similar). This is a deliberate decision on the part of YouTube, to prevent theft of content. Of course, this doesn't provide a very satisfactory experience. There are back-door hacks to get higher resolution streams, but they aren't supported on all releases of Android and using them is a violation of YouTube's terms of service.
3) The RTSP streams can be blocked by some internal networks/firewalls, so this approach may not work for all users.
The third option is to embed a WebView in your application. There two approaches you can take here:
1) You can embed a Flash object and run the standard desktop Flash player for YouTube. You can even use the Javascript API to control the player, and relay events back to the native Android app. This approach works well, but unfortunately Flash is being deprecated on the Android platform, and will not work for Android 4.1 and later.
2) You can embed a <video> tag to play YouTube via HTML5. Support for this varies between various releases of Android. It works well on Android 4.0 and later; earlier releases have somewhat spotty HTML5 <video> support. So, depending upon what releases of Android your application must support, you can take a hybrid approach of embedding HTML5 on Android 4.x or later, and Flash for all earlier versions of Android.
There are several threads here on StackOverflow about using HTML5 to play YouTube video; none of them really describe the entire process you must follow in one place. Here's links to a few of them:
Android - How to play Youtube video in WebView?
How to embed a YouTube clip in a WebView on Android
Play Youtube HTML5 embedded Video in Android WebView
All of this will get dramatically easier in the weeks/months to come; at Google I/O 2012, they presented/demoed a new YouTube API for Android that will support direct embedding of YouTube content in your application, with full support back to Android 2.2 (about 95% of the Android userbase as of this writing). It can't arrive fast enough.
Thanks #mportuesisf for this wonderful answer.
Heres some links.
http://docs.xamarin.com/recipes/android/media/video/play_video/
Streaming Youtube Videos
for xamarin forms you can use HtmlWebViewSource
in my VM:
public HtmlWebViewSource VideoSource { get; set; }
in constructor :
VideoSource = new HtmlWebViewSource();
VideoSource.Html = #"<html><body> <div style=' position: relative; padding-bottom: 56.25%; padding-top: 25px;'> <iframe style='position: absolute; top: 0; left: 0; width: 100%; height: 100%;' src='https://www.youtube.com/embed/bVdfj7HXuXE' frameborder='0' allowfullscreen></iframe></div> </body></html>";
in my View :
<WebView VerticalOptions="Fill"
HorizontalOptions="Fill"
Source="{Binding VideoSource}"
/>
firstly you must copy the link above the video youtube when you click on share then choose integrate and select the src of the youtube video
then in your c sharp create :
and you're gonna see the video inside the web view
WebView webview = FindViewById<WebView>(Resource.Id.webView1);
video =("the src of the youtube video");
var uri = Android.Net.Uri.Parse(video);
WebSettings settings = webview.Settings;
settings.JavaScriptEnabled = true;
webview.SetWebChromeClient(new WebChromeClient());
webview.LoadUrl(video);

How to play Flash videos with a Gecko WebBrowser? (GeckoFX)

I'm using the GeckoFX 'GeckoWebBrowser' user control to navigate but I can't play Flash videos of any page, for example if I try to navigate to youtube it always displays this error:
There is a way to enable Flash videos?
UPDATE:
I've set this property:
GeckoPreferences.Default("extensions.blocklist.enabled") = False
...And now the background of the videos are shown but I can't reproduce any video.
About the "Emoticon" who says that this video is unaivailbe : this is because the page is not showing properly so you can see all divisions what should be hidden in the page like you must enable JavaScript in your browser.
i had simmilar problems with GeckoFx my suggestion is moving to WEBKITDOTNET is the best for now as compenent
Here

How to open mobile view of website in Windows Phone application?

I am trying to open a web page in my Windows Phone application. But, I am unable to open desired web page in its mobile form.
I am adding web browser in my XAML:
</Grid>
<phone:WebBrowser x:Name="wb" HorizontalAlignment="Left" Margin="0,10,0,0" Grid.Row="1" VerticalAlignment="Top" Height="686" Width="480" Loaded="wb_Loaded"/>
</Grid>
And this is my backend code in C#:
private void wb_Loaded(object sender, RoutedEventArgs e)
{
wb.Navigate(new Uri("http://facebook.com/mobile", UriKind.Absolute));
}
But I am unable to view the actual mobile web page of Facebook. This code makes Facebook to look very much ugly.
I tried with http://m.facebook.com also, but this is also not helping.
Please suggest me, how can I correct this error to have actual mobile web page of Facebook in my application.
Wrong mobile url, mobile sites are usually differentiated by the prefix m such as facebooks' actual mobile page https://m.facebook.com which is the subdomain usage for the mobile apps. The mobile page you linked to is to install a mobile app; which is a standard html viewing type page and not mobile.

Categories

Resources