how to play and stop sound control by javascript in wmplayer? - asp.net

how to play and stop sound control by javascript in wmplayer in asp.net ?

You can embed the windows media player in an HTML page and then use javascript to manipulate the object.
They have properties for volume, balance and methods to mute.
http://msdn.microsoft.com/en-us/library/dd564581(VS.85).aspx
EDIT:
Here's another good reference: http://www.mioplanet.com/rsc/embed_mediaplayer.htm

<script type="text/javascript">
function doThings(n) {
if(n==1)
document.getElementById('VIDEO').controls.play();
else
if(n==2)
document.getElementById('VIDEO').controls.stop();
}
</script>
<OBJECT id="VIDEO" width="320" height="240"
CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
type="application/x-oleobject">
<PARAM NAME="URL" VALUE="town.mid">
<PARAM NAME="SendPlayStateChangeEvents" VALUE="True">
<PARAM NAME="AutoStart" VALUE="False">
<PARAM name="uiMode" value="none">
<PARAM name="PlayCount" value="9999">
</OBJECT>
<input type="button" value="start" onclick="doThings(1)"/>
<input type="button" value="stop" onclick="doThings(2)"/>

Related

Showing image from different project ASP.NET

HTML
<h3>Single Upload</h3>
<form method="post" enctype="multipart/form-data">
File <input type="file" name="file" />
<br />
<input type="button" value="Upload" onclick="return SaveExit()" />
</form>
<img src="C:/Users/Gigabyte/source/repos/ReimbursementSystem/ReimbursementSystemAPI/wwwroot/Images/biomimikrifix1.png" width="100" height="200" alt="3" />
I want to simply show the image from the other project with the path but it doesn't work. is there a way to simply show it from another project?
In ASP.Net Core MVC you are not allowed to load local resource file rather than wwwroot/images folder by default. But if you want to use a different location then you can simply add this middleware to your startup.cs
Startup.cs
app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(
Path.Combine(#"C:\Users\Gigabyte\source\repos\ReimbursementSystem\ReimbursementSystemAPI\wwwroot", "images")),
RequestPath = "/images"
});
cshtml
<img src="/Images/biomimikrifix1.png" width="100" height="200" alt="3"/>
Hope this will solve your issue.
You can use this code
<img src="/Images/biomimikrifix1.png" width="100" height="200" alt="3" class="detailImage" />

How to display video as icons in website?

Is there a way to display the video in a website page as an arranges icons of videos or thumbnails, so whenever I click on one video it should open a new window to play that video? not play it in the same page.
as this code, but the target="_blank" not leading me to another page?
<a href="video1.aspx" target="_blank">
<object type="video/x-ms-wmv" data="Videos/clock.avi" width="320" height="255" >
<param name="src" value="Videos/clock.avi">
<param name="autoStart" value="0">
alt : clock.avi
</object>
</a>
When you see that with Youtube or other streaming website, is not VideoObject was open a website with video, is just a link to one page with the same video...
You have lot of method for create this "effect" , for optimize, you want just load One image (for create a thumbnails) of your video for create the link
<a href="pageofyourvideo.aspx" target="_blank">
<img src="yourVideoImage.jpg" title="myVideotitle" />
</a>
because, it's unnecessary to load your video, if it's just for link here in other page...
In your video Page, you can juste play your video...
<div id="myVideoBox">
<object type="video/x-ms-wmv" data="Videos/clock.avi" width="320" height="255" >
<param name="src" value="Videos/clock.avi">
<param name="autoStart" value="0">
</object>
</div>
If you've few competences in your language ( aspx, html ? ) you want to create one same page for all your videos, with a parameter in your link in all thumbnails...
For sample, you can create two thumbnails with the same link, and just parameter change :
sample with php link :
<!-- first Thumbnails link to video1.avi -->
<a href="pageofyourvideo.php?myvideo=video1.avi" target="_blank">
<img src="yourVideoImage.jpg" title="myVideotitle" />
</a>
<!-- second thumbnails link to video2.avi -->
<a href="pageofyourvideo.php?myvideo=video2.avi" target="_blank">
<img src="yourVideoImage2.jpg" title="myVideotitle2" />
</a>
and you received parameters in your video page : (always with php...)
<!-- If parameter "myvideo" was "video2.avi" video2.avi was played... -->
<div id="myVideoBox">
<object type="video/x-ms-wmv" data="Videos/clock.avi" width="320" height="255" >
<param name="src" value="<?php echo $_GET["myvideo"]; ?>">
<param name="autoStart" value="0">
</object>
</div>
I use .php for sample because I'm not familiar with .aspx but you can make this sample in .aspx :-)

how to mute the .swf video while playing?

Actually i tried the below HTML command for mute the flash video.
enter code here
<HTML>
<HEAD>
<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
<TITLE>Sound OFF</TITLE>
</HEAD>
<BODY bgcolor="#FFFFFF">
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="500" HEIGHT="200" id="header123" ALIGN="">
<PARAM NAME=movie VALUE="file:///opt/python/data/107.swf?playSound=var_stop">
<PARAM NAME=quality VALUE=high>
<PARAM NAME=bgcolor VALUE=#FFFFFF>
<EMBED src="file:///opt/python/data/107.swf?playSound=var_stop" quality=high bgcolor=#FFFFFF WIDTH="500" HEIGHT="200" NAME="header123" ALIGN="" TYPE="application/x-shockwave-flash">
</EMBED>
</OBJECT>
</BODY>
</HTML>
Afaik, you cant mute a Flash Video over HTML, unless the developer implemented a parameter for it inside of the Flash.
playSound=var_stop could work, if this parameter is handled inside of the Flash - but probably it's not.
You will have to change the flash so that it can handle a parameter for this.
var tt=[];
tt=document.getElementsByTagName('object');
for (i in tt) {
try {
typeof tt[i] == 'function' && tt[i].mute();
} catch (err) {
}
}
it stop all object sound on current page . It work for me

Can an HTML object tag be placed inside an HTML form tag?

I have a simple ASP.NET page that uses the VLC media player to play a video in IE. I also have four buttons to control the playback:
Play, Pause, Stop, and Mute
The four buttons call JavaScript functions that access the ActiveX control. When I click on any of the buttons, I get the following error in the JavaScript function:
"Microsoft JScript runtime error: 'vlc' is undefined".
However, if move the object tag for the vlc player outside the form tag, then the JavaScript works correctly, and I can control the video playback.
My question is why must the object tag be outside the form tag for this code to work correctly?
<%# Page Language="C#" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="VlcTest.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>VLC Test Page</title>
<script type="text/javascript">
function mute() {
vlc.audio.toggleMute();
}
function play() {
vlc.playlist.play();
}
function stop() {
vlc.playlist.stop();
}
function pause() {
vlc.playlist.togglePause();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<object type="application/x-vlc-plugin"
id="vlc"
width="720"
height="548"
classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" >
<param name="MRL"
value="C:\Inetpub\wwwroot\Movies\Funny Cats.flv" />
<param name="volume" value="50" />
<param name="autoplay" value="false" />
<param name="loop" value="false" />
<param name="fullscreen" value="false" />
</object>
<br />
<div id="controls">
<input type="button" onclick="play()" value="Play" />
<input type="button" onclick="pause()" value="Pause" />
<input type="button" onclick="stop()" value="Stop" />
<input type="button" onclick="mute()" value="Mute" />
</div>
</div>
</form>
</body>
</html>
The problem is that inside the <form> tag the <object> element is out of scope.
Try using:
function play() {
var player = document.getElementById("vlc");
player.playlist.play();
}

Using Object tags in asp.net

I have this html code for embedding a video in an aspx page:
<OBJECT ID="MediaPlayer" WIDTH="192" HEIGHT="190" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
STANDBY="Loading Windows Media Player components..." TYPE="application/x-oleobject">
<PARAM NAME="FileName" VALUE="videofilename.wmv">
<PARAM name="autostart" VALUE="false">
<PARAM name="ShowControls" VALUE="true">
<param name="ShowStatusBar" value="false">
<PARAM name="ShowDisplay" VALUE="false">
<EMBED TYPE="application/x-mplayer2" SRC="videofilename.wmv" NAME="MediaPlayer"
WIDTH="192" HEIGHT="190" ShowControls="1" ShowStatusBar="0" ShowDisplay="0" autostart="0"> </EMBED>
</OBJECT>
The thing is, I want to set its parameters from my C# code-behind (f.e., the path to the file to be played).
I know I should add runat="server" but that's not the only thing. The code-behind doesn't recognize any element of the type MediaPlayer no matter what. (I'm trying to access it from my Page_Load(..))
How should I do this?
10x
Create a HtmlGenericControl. You can set the attributes through the Attributes property via your codebehind. And add the sub-elements through Controls.
HtmlGenericControl obj = new HtmlGenericControl("object");
HtmlGenericControl embedTag = new HtmlGenericControl("embed");
embedTag.Attributes["type"] = "application/x-mplayer2";
obj.Controls.Add(embedTag);
flashPlaceHolder.Controls.Add(obj);
There is no ASP.NET control for the OBJECT tag, so you have to generate its HTML yourself. There are two simple ways to do this. The first way is to use <% %> tags in your ASPX file, like this:
<OBJECT ID="MediaPlayer" WIDTH="192" HEIGHT="190" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
STANDBY="Loading Windows Media Player components..." TYPE="application/x-oleobject">
<PARAM NAME="FileName" VALUE="<% =FileName %>">
...
</OBJECT>
The other way is to create a LiteralControl in your codebehind, and set its HTML to whatever you want:
LiteralControl myObject = new LiteralControl();
myObject.Text =
#"<OBJECT ID='MediaPlayer' WIDTH='192' HEIGHT='190' CLASSID='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' STANDBY='Loading Windows Media Player components...' TYPE='application/x-oleobject'>
<PARAM NAME='FileName' VALUE='" + FileName + "'>
...
</OBJECT>';";
Page.Controls.Add(myObject);

Resources