JS Method for operating streaming media videos

Source: Internet
Author: User

<SCRIPT>
Function show (UR, ID ){

VaR plaryer = Document. getelementbyid ("mediaplayer1 ")
For (VAR I = 0; I <plaryer. currentplaylist. Count; I ++ ){
// Alert (plaryer. currentplaylist. Item (I). getiteminfo ("title "));
If (plaryer. currentplaylist. Item (I). getiteminfo ("title") = ID) {// corresponds to the player title based on the vid In the div.
Plaryer. Controls. playitem (plaryer. currentplaylist. Item (I); // specifies the number of players.
Plaryer. Controls. currentposition = Ur; // you can specify the playback time.
}
}

}
Function pause (){
VaR vid = Document. getelementbyid ("mediaplayer1"). currentmedia. getiteminfo ("title ");
// Alert (s );
VaR current_time = Document. getelementbyid ("mediaplayer1"). Controls. currentposition;
VaR current_times = parseint (current_time );
VaR OBJ = Window. Top. Frames ['pptsld'];
VaR returns = obj.doc ument. getelementsbyname ("showsd ");
If (returns. length> 0) return returns;
Returns = new array ();
VaR E = obj.doc ument. getelementsbytagname ("Div ");

var URLs = obj. Location. href; // obtain "? "Character string
var url =" ";
var Va =" ";
If (URLs. indexof ("#") >=0) {
url = URLs. substr (0, URLs. indexof ("#");
Va = URLs. substr (URLs. indexof ("#"), URLs. length);
}else {
url = URLs;
}

VaR J = 0;
For (VAR I = 0; I <E. length; I ++ ){
If (E [I]. getattribute ("name") = "showsd "){
If (E [I]. classname! = "Box2 "){
E [I]. classname = "box2"; // reply style
}
If (E [I]. getattribute ("vid") = VID ){
If (current_times> = E [I]. getattribute ("timeflag") {// determines whether the current time is smaller than the time found for the PPT.
J = I;
}
}
}

If (I + 1 = E. Length ){
// Alert (E [I]. getattribute ("ID "));
If (Va = ""){
OBJ. Location. href = URL + "#" + E [J]. getattribute ("ID ");
} Else {
If (va! = "#" + E [J]. getattribute ("ID ")){
// Alert (VA );
OBJ. Location. href = URL + "#" + E [J]. getattribute ("ID ");
// Alert (obj. Location. href );
}
}

If (E [J]. classname! = "") {
E [J]. classname = "box" // change its style so that it is playing
}< BR >}< br> setTimeout ('pause () ', 1000 );
}< br> // alert (document. getelementbyid ("mediaplayer1 "). getmediainfostring (9);

</Head>
<Body onload = "Pause ()">
<Form ID = "form1" runat = "server">
<Div id = "TXT" style = "color: # ff0000; font-weight: bold; font-size: 18px; font-family: Arial">
<Object classid = "CLSID: 6bf52a52-394a-11d3-b153-00c04f79faa6" width = "286" Height = "255"
Codebase = "http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,

52,701 "id =" mediaplayer1 "type =" application/X-oleobject "standby =" loading Microsoft & reg; Windows & reg; Media Player components... ">
<Param name = "autostart" value = "-1"/>
<! -- Automatic playback? -->
<Param name = "balance" value = "0"/>
<! -- Adjust the left-right channel balance. Code -->
<Param name = "enabled" value = "-1"/>
<! -- Whether the player can be controlled by humans -->
<Param name = "enablecontextmenu" value = "-1"/>
<! -- Enable context menu -->
<Param name = "url" value = '<% = URL %>'/>
<! -- Playback file address -->
<Param name = "playcount" value = "1000"/>
<! -- Control the number of playbacks, which is an integer -->
<Param name = "rate" value = "1"/>
<! -- The playback speed is controlled. 1 is normal, and decimal places are allowed. -->
<Param name = "currentposition" value = "0"/>
<! -- Control settings: Current Position -->
<Param name = "currentmarker" value = "0"/>
<! -- Control settings: Current tag -->
<Param name = "defaultframe" value = ""/>
<! -- Display default frame -->
<Param name = "invokeurls" value = "-1"/>
<! -- Script command setting: whether to call URL -->
<Param name = "baseurl" value = ""/>
<! -- Script command setting: called URL -->
<Param name = "stretchtofit" value = "0"/>
<! -- Scale up or not -->
<Param name = "volume" value = "50"/>
<! -- The default sound size is 0%-100%, and 50 is 50%. -->
<Param name = "mute" value = "0"/>
<! -- Mute or not -->
<Param name = "uimode" value = "full"/>
<! -- Player display mode: full display all; Mini is the most simplified; none does not show the playback control, only displays the video window; invisible all

Do not show -->
<Param name = "windowlessvideo" value = "0"/>
<! -- If it is 0, full screen is allowed; otherwise, it can only be viewed in the window -->
<Param name = "fullscreen" value = "0"/>
<! -- Whether to enable automatic full screen playback -->
<Param name = "enableerrordialogs" value = "-1"/>
<! -- Enable error prompt report -->
<Param name = "samifilename"/>
<! -- Subtitle id -->
<Param name = "displaysize" value = "3"/>
<Param name = "showdisplay" value = "1">
</Object>
<Div id = "Mu" runat = "server">
</Div>
</Div>
</Form>
</Body>
</Html>

<SCRIPT>
Function gonote (PA ){
VaR OBJ = Window. Top. Frames ['pptotl '];
VaR vid = pa. Vid;

VaR plaryer = obj.doc ument. getelementbyid ("mediaplayer1 ");
// Alert (plaryer. currentplaylist. Item (0 ));
VaR titles = plaryer. currentmedia. getiteminfo ("title ");
// Alert (plaryer. currentplaylist. Item (1). getiteminfo ("title "));
For (VAR I = 0; I <plaryer. currentplaylist. Count; I ++ ){
// Alert (plaryer. currentplaylist. Item (I). getiteminfo ("title "));
If (plaryer. currentplaylist. Item (I). getiteminfo ("title") = VID) {// corresponds to the player title based on the vid In the div.
Plaryer. Controls. playitem (plaryer. currentplaylist. Item (I); // specifies the number of players.
Plaryer. Controls. currentposition = pa. timeflag;
}
}

}
</SCRIPT>

ASX playback list:

If (! Ispostback)
{
// String S = request. servervariables ["http_referer"]. tostring ();
// String S = request. urlreferrer. tostring ();
// Session ["video"]! = NULL
If (session ["video"]! = NULL)
{

Int vid = 0;
If (request. querystring ["vid"]! = NULL)
{
Vid = int. parse (request. querystring ["vid"]. tostring ());
}
String SQL = "select paths, PID from voidepathtb where vid =" + vid;
Datatable dt = dbhelper. getdatatable (SQL, commandtype. Text, null );
Response. Clear ();
String info = "<ASX version = \" 3.0 \ "> ";

For (INT I = 0; I <DT. Rows. Count; I ++)
{
Info + = "<entry> <title>" + dt. rows [I] ["PID"]. tostring () + "</title> <ref href =" + "\" "+ server. urlpathencode (DT. rows [I] ["paths"]. tostring () + "\"/> </entry> ";
}
Info + = "</ASX> ";
Response. Write (Info );
Session. Remove ("video ");
Response. End ();

}
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.