Displayimg youtube videos in windowsphone - windows-phone-7.1

I have dispalyed videosongs in list box.And when i click on a particular videosong it should be navigated to other page and play. My code for playing is
Xaml code:
<StackPanel VerticalAlignment="Top" Height="600" Margin="0,0,0,0">
<TextBlock x:Name="title" TextWrapping="Wrap" VerticalAlignment="Top" Height="40"></TextBlock>
<phone:WebBrowser x:Name="webBrowser" Height="411" IsScriptEnabled="True" Margin="10,0,78,0" />
Xaml.cs:
public Videopage()
{
InitializeComponent();
string video = "<iframe src=";http://www.youtube.com/embed/JJYNDFxtUIg" width="646" height="365" frameborder="0" allowfullscreen></iframe>
this.Navigate.ToString(video);
}
I was coming across error:
Error 1 'videosongs.Videopage' does not contain a definition for 'Navigate' and no extension method 'Navigate' accepting a first argument of type 'videosongs.Videopage' could be found (are you missing a using directive or an assembly reference?)
Anybody please help me. I was trying this app from many days.I have tried in many methods also.Even though i was i was unable to play videos.When the page was navigated blank screen was displaying in the emulator.I was using windows7.1 emulator.
Many thanks in advance.

Try:
this.webBrowser.NavigateToString(video);
You were calling navigate on the page, not on the browser control.
You also have bigger issues. You're original code wasn't formatted correctly and included a an incorrect/invalid semi-colon before the URI. It should have been:
string video = "<iframe src=\"http://www.youtube.com/embed/JJYNDFxtUIg\" width=\"646\" height=\"365\" frameborder=\"0\" allowfullscreen></iframe>";
Even this won't help you though as YouTube won't play the embedded content in an iframe in an embedded browser.
This will display the photoframe though though. And when tapped the film will be opened in the native player. It won't play embedded within the page.
string video = "http://www.youtube.com/embed/JJYNDFxtUIg";
this.webBrowser.Navigate(new Uri(video));

Related

Opening a Word document at a particular bookmark

Using MVC 5 Razor Views.
I currently have a link to open a document that sits on the server in my about view as follows........
Basic Training <img src="~/Content/Images/Word.jpg" height="24" width="24" />
What I'd like is to be able to have a link to open this document at a particluar bookmark.
From what I have read so far, it would seem that the bookmark is specified after a # symbol. Unfortunately it doesn't seem to work and the document just opens from the start.
I've tried opening via an action using the #' notation as werll, but as yet, no joy.
FileStream fs = new FileStream(Server.MapPath(#"~\Content\My Doc - Basic Training.docx"), FileMode.OpenOrCreate, FileAccess.ReadWrite);
return File(fs, "My Doc - Basic Training.docx");
I've simply been appending #BoomarkName to the filename. No joy as of yet.
Is it possible?
If so could someone please point me in the right direction.
Just seems to work with #bookmark_name, as explained in How to create a hyperlink from an HTML page to a bookmark in Word.
So:
Basic Training <img src="~/Content/Images/Word.jpg" height="24" width="24" />

Why is the file upload disabled in the Youtube Upload Widget?

I have just been looking into allowing my users to upload videos to their YouTube accounts directly from my site using the Youtube Upload widget. This widget is like 1000 times easier to deploy that the usual API process.
I have seen that it currently defaults to webcam_only=true but am wondering why? If I change the iframe to webcam_only=false I get the upload button and it all seems to work fine...
Obviously it would be an enourmous time saver for me if I could just use this functionality as opposed to trying to get my head around the whole API 2 way of doing things- plus that method seems to require refreshing the page which is no good for my app.
Any updates on why this is disabled and when it may be enabled?
Thanks in advance
webcam_only is set to true by default if the api creates the api. You can create the iframe element yourself as detailed in the "Loading an upload widget" of the developer docs.
https://developers.google.com/youtube/youtube_upload_widget
<iframe id="widget" type="text/html" width="640" height="390"
src="https://www.youtube.com/upload_embed" frameborder="0"></iframe>
<script>
widget = new YT.UploadWidget('widget', {
});
</script>
Or
<div id="widget"></div>
widget = new YT.UploadWidget('widget', {
webcamOnly: true;
});
I believe the option to upload videos using the YouTube Upload Direct widget has been removed as of August 2012. Although you can force add the upload button you get the button, but nothing happens with it.
https://developers.google.com/youtube/youtube_upload_widget#Revision_History
August 22, 2012 This update contains the following changes:
The webcamOnly property has been removed from the list of widget options that you can specify in the constructor for the upload widget.
Previously, this property was documented as having a default value of
false, which would mean that the widget would also display a button
for uploading an existing video file. However, the option to upload an
existing file is not currently supported, so the widget always only
displays an option to record and upload a webcam video.
Here is an example of the button with no action: http://sandboxsite.us/youtubetest.php
This is using:
<iframe id="widget" type="text/html" width="640" height="390"
src="https://www.youtube.com/upload_embed?webcam_only=false" frameborder="0"></iframe>
<script>
widget = new YT.UploadWidget('widget', {
});
</script>
If anyone figures out how to add the button AND make the uploads work, I'd surely buy them a beer!

Populating Iframe with PDF - Using MVC [IE Issue]

Currently, I have an issue with populating an iframe that I have with a PDF document, but this issue only occurs in IE.
Basic Layout:
I have a screen that contains a list of items (attachments), which can be images, text or pdf. When the user clicks on one of these items - it will make a call to a controller action [ViewAttachment] which will return the requested item and display it in the iframe.
This currently works for all data types with the exception of PDFs in IE. (Firefox, Chrome etc. all display the PDF in the iframe without issue.)
I previously was using Adobe Reader 9, and recently upgraded to 10 in hopes of solving this issue. I'll attach some code to see if anyone has any suggestions as to how to possibly resolve this.
Code to Populate iframe: (Moved to two lines for readability)
$(".viewattachment").live('click',function ()
{
$("iframe#test").attr("src","<%=Url.Action("ViewAttachment","Images") %>?
attachment=" + $(this).next().val());
});
ViewAttachment Controller Action:
public ActionResult ViewAttachment(string attachmentGuid)
{
Attachment attachment= imageAgent.GetAttachment(attachmentGuid);
Stream resultStream = new MemoryStream();
resultStream = StorageProviders[attachment.ProviderName]
.ReadFile(attachment.FileReference);
resultStream.Position = 0;
FileStreamResult result = new FileStreamResult(resultStream,
attachment.ContentType);
return result;
}
Notes:
I've attempted toggling the "Display PDF in Browser" in Adobe Reader without any success.
Currently testing this for IE8.
When clicking on a PDF to view - the iframe simply remains at it's previous content and doesn't change at all.
After several different methods and iterations of testing - I determined that it was a conflict between IE8-9 and versions of Adobe Reader 9-10. I added the following meta tag to the window containing the iframe and it resolved all of the issues:
<meta http-equiv="X-UA-Compatible" content="IE=7" />
This should at least work until an update / fix is made.
Have you tried hitting the pdf url directly? If it loads within the browser, then you can narrow down the problem to the iframe. If Adobe Reader pops up, then you know its a problem with the IE Plugin.
I had the same problem working with spring mvc. I releazed that if I put the Iframe inside some tag, like 'util:panel', the iframe does not load de pdf content in IE 8. When I put the iFrame out of the tag, all work fine.

How to parse embedded videos from youtube, vimeo, etc

I'm working with Ruby On Rails 2.3.8 and I'm using TinyMCE with image and video upload functionalities.
I've figured out that when I insert a Vimeo video, it won't work, because it needs it's own iframe, as the following:
<iframe src="http://player.vimeo.com/video/16430948" width="400" height="225" frameborder="0"></iframe><p>YOU! - Heart from KUSKUS on Vimeo.</p>
I'm now wondering how to show either youtube (which work just fine), vimeo, and other kind of embedded videos.
Update:
Searching on the internet I've found the following code, in the file /plugins/media/media.js, within getType function:
// Vimeo
if ( v.match(/^http:\/\/(?:www\.){0,1}vimeo\.com\/(\d+)$/) ) {
f.width.value = '400';
f.height.value = '321';
f.src.value = 'http://vimeo.com/moogaloop.swf?clip_id=' + v.match(/^http:\/\/(?:www\.){0,1}vimeo\.com\/(\d+)$/)[1];
return 'flash';
}
But it's not working for me. At least, all I see is that it's treating it as it was a common flash video, instead of inserting an iframe on the html for playing it (as it's done when you click the "Embed" button at vimeo.com).
The iframe tag usually gets removed (cleanup) if you do not specify otherwise.
Add this to your tinymce configuration to keep iframes inside the editor:
extended_valid_elements:"iframe[id|class|title|style|align|frameborder|height|longdesc|marginheight|marginwidth|name|scrolling|src|width]",
This thread might be of help too.

Display flash player in place of URL

Yahoo IM has a neat trick. If you post a URL link to a youtube video, it displays in it's place a flash player with that url's video loaded.
I would like to do the same for my Delphi(7) based chat room (www.magchat.com). The display component is TRichView.
I've scoured Google and sent numerous emails without any success... anyone have any suggestions?
The effect I am trying to achieve is when a User posts a URL link to youtube in the chat program... main form using the TRichView Component... the program would spawn a flash player instead of the url, with the movie playing from the url link. I don't have any idea how to amake this happen, but as I said, I've seen this done in Yahoo's IM program, so it's apparently possible.
There isn't any way to embed twebbrowser in the TRichView Component that I am aware of. I was assuming this would have to be some sort of flash player called when the url is detected. The TRichView Component does support flash.
I hope that's clear. I'm not sure my initial questions was completely clear.
Thanks in advance,
Mark Gundy
www.magchat.com
Whenever you see a http://www.youtube.com/watch URL with a v parameter, just include the following HTML snippet:
<object width="425" height="344">
<param name="movie" value="http://www.youtube.com/v/[video-id]&hl=en&fs=1&">
</param>
<param name="allowFullScreen" value="true">
</param>
<param name="allowscriptaccess" value="always">
</param>
<embed src="http://www.youtube.com/v/[video-id]&hl=en&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344">
</embed>
</object>
replacing each occurrence of [video-id] with the v parameter from the URL.
The above HTML snippet is just the "Embed" code taken straight from the page for a random YouTube video. You can tweak some of the parameters like the size, etc.
TRichView already knows how to display HTML, right? You shouldn't need to embed a TWebBrowser in it. So can't you insert the HTML that Laurence's answer demonstrates? You said the component supports Flash, after all.
If it turns out TRichView doesn't support Flash, then try embedding it as a Delphi control, instead. You already asked how to do that. TRichView says it knows how to insert Delphi controls, so import the Flash ActiveX player into Delphi; that will define a Delphi component, which you should be able to put onto the TRichView.
To be able to embed a youtube video in a Delphi win32 app you need to wrap the flash activeX control into a component, so Watch this video.
To display the video just set the movie property of the TShockWaveFlash component. If your url is http://www.youtube.com/watch?v=oGeCqRfRAcQ - convert this to http://www.youtube.com/v/oGeCqRfRAcQ&hl=en&fs=1
It seems to take awhile for the video to become available, and doesn't seem to work the first time I run the application, no idea why, but I'll let you solve that one (it's the first time I've tried this).
You might also want to look into oEmbed. It's a standard way to request the embedded version of a media file so you don't have to do any of the search/replace recommended by other users. Here's a YouTube example:
You have a YouTube URL:
http://youtube.com/watch?v=M3r2XDceM6A
You make a request to YouTube's oEmbed endpoint to get the embed code:
http://www.youtube.com/we/love/oembed/?url=http%3A//youtube.com/watch%3Fv%3DM3r2XDceM6A&format=json
And they return a JSON response that includes an HTML snippet:
{
"version": "1.0",
"type": "video",
"provider_name": "YouTube",
"provider_url": "http://youtube.com/",
"width": 425,
"height": 355,
"title": "Amazing Nintendo Facts",
"html":
"<object width=\"425\" height=\"355\">
<param name=\"movie\" value=\"http://www.youtube.com/v/M3r2XDceM6A&hl=en\"></param>
<param name=\"wmode\" value=\"transparent\"></param>
<embed src=\"http://www.youtube.com/v/M3r2XDceM6A&hl=en\" type=\"application/x-shockwave-flash\"
wmode=\"transparent\" width=\"425\" height=\"355\"></embed>
</object>",
}
oEmbed is also supported by many other websites: Flickr, Viddler, Qik, Hulu, Vimeo, etc.

Resources