Display flash player in place of URL - delphi

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.

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" />

Displayimg youtube videos in windowsphone

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));

Stream video from website, and support modern browsers (incl. IE) *and* iPad

My boss wants the following:
Requirements: Stream m4v videos from our Web-server to clients including standard web browsers (IE7, FF, Chrome, etc) and iPad!
I'm not really sure why he wants m4v...he mentioned efficiency but it may also have to do with iPad compatibility?? Anyway, I'm stuck with m4v.
I've browsed some related questions on SO, and this page is very useful as well:
http://henriksjokvist.net/archive/2009/2/using-the-html5-video-tag-with-a-flash-fallback
So if I understand correctly, HTML5 with <video> tag will take care of all my requirements (browsers & iPad) except IE up to and including IE8.
So in my code:
<div id="demo-video-flash">
<video id="demo-video" poster="snapshot.jpg" controls>
<source src="video.m4v" type="video/mp4" /> <!-- MPEG4 for Safari -->
<source src="video.ogg" type="video/ogg" /> <!-- Ogg Theora for Firefox 3.1b2 -->
</video>
</div>
<script type="text/javascript">
$(document).ready(function() { // ... a dash of jQuery.
var v = document.createElement("video"); // Are we dealing with a browser that supports <video>?
if ( !v.play ) { // If no, use Flash.
var params = {
allowfullscreen: "true",
allowscriptaccess: "always"
};
var flashvars = {
file: "video.f4v",
image: "snapshot.jpg"
};
swfobject.embedSWF("player.swf", "demo-video-flash", "480", "272", "9.0.0", "expressInstall.swf", flashvars, params);
}
});
</script>
As the link above explains, test if the browser supports <video>, and if not, fall back to flash. If the browser supports <video>, I don't need to worry about the player as the browser handles that. If it doesn't support <video>, I need to provide:
(a) A flash player.
(b) A flash-compatible copy of my .m4v video
Questions:
1) Will this solution work for my requirements?
2) Is .m4v a good format to stream to iPad? (I'm guessing yes as it's an Apple proprietary format!)
3) Is .m4v "flash-comatabile"? That is, if I send it to my flash player will it work? I've read conflicting reports on this. If it's not, then I guess I need to have a copy of my video converted to a flash-compatable format...any recommendations? (.f4v seems common but we already have a .mov file will that work?)
4) Last but not least, what's a good flash player. I'm leaning toward flowplayer (http://flowplayer.org/), however, we already have a swf player installed (http://code.google.com/p/swfobject/). Seems this latter one would work...any advantages to one or the other??
Apologies if some parts of this question don't make sense...there's alot of info about video out there and it's hard to piece it all together...hoping some answers here may help. I can refine my question as needed.
Thanks in advance!
Peter
As far as I know..., IE does not support HTML5 so the tag would be unrecognized in IE...

Flash stream player (tutorial?)

I'm working at a radio station in my free time. I host a radio show there and currently were building a new website for the show. There is a audio stream available but there's no flahs player or what so ever, so i decided to build one for the new website. I know a bit about flash, i can create animations etc but i have no knowledge about actionscript... Could someone tell me where i could find a tutorial about this stuff?
This is the content of the asx file from the stream (http://content.streamone.nl/livestream/ne48FnM3kp.asx) :
<ASX version = "3.0">
<Abstract>Served by StreamOne - Streaming Media Platform</Abstract>
<Title>Seaport FM</Title>
<Author>NA</Author>
<Copyright>Copyright</Copyright>
<Param NAME="Prebuffer" Value="True" />
<Entry>
<Ref href="http://icecast.streamone.nl/ne48FnM3kp" />
<Title>Seaport FM</Title>
<Author>NA</Author>
<Copyright>Copyright</Copyright>
<Abstract></Abstract>
</Entry>
</ASX>
I have searched on google etc but i cant find anything i can understand
Greetz, rutgerinc
two simple examples.
and reference: flash.media.Video, flash.net.NetConnection and flash.net.NetStream

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.

Resources