Multimedia (Multimedia) in JavaScript

The navigator object in JavaScript includes a child object called plugins. This object is an array, with an entry for each plug-in installed in the browser. The navigator.plugins object is only supported by Netscape, Firefox and Mozilla.

For example

Below is an example to illustrate how to list all plug-ins installed in your browser.

 List of Plug-Ins  border = "1" >   Plug-in Name   Filename   Description  language = "JavaScript" type = "text/javascript" > for ( i = 0 ; i < navigator . plugins . length ; i ++) { document . write ( "" ); document . write ( navigator . plugins [ i ]. name ); document . write ( "" ); document . write ( navigator . plugins [ i ]. filename ); document . write ( "" ); document . write ( navigator . plugins [ i ]. description ); document . write ( "" ); } 

Result

Multimedia (Multimedia) in JavaScript Picture 1

Check for Plug-Ins

Each plug-in has an entry in that array. Each gateway has the following properties:

name - The name of the plug-in.

filename - An executable file that is downloaded to install the plug-in.

Description - A description of the plug-in, provided by the programmer.

mimeTypes - An array with an input port for each MIME type supported by that plug-in.

You can use these properties in a script to find installed plug-ins, and then use JavaScript, you can play the appropriate multimedia files. You observe the following example:

 Using Plug-Ins  language = "JavaScript" type = "text/javascript" > media = navigator . mimeTypes [ "video/quicktime" ]; if ( media ){ document . write ( "  " ); } else { document . write ( " Multimedia (Multimedia) in JavaScript Picture 2 " ); } 

Result

Run the above command to see the result

Note - Here we are using HTML tags to embed multimedia files.

Multimedia control

Together we do a real example that works in most browsers:

 Using Embeded Object  type = "text/javascript" >   id = "demo" name = "demo" src = "http://www.amrood.com/games/kumite.swf" width = "318" height = "300" play = "false" loop = "false" pluginspage = "http://www.macromedia.com/go/getflashplayer" swliveconnect = "true" >  name = "form" id = "form" action = "#" method = "get" >  type = "button" value = "Start" onclick = " play (); " />  type = "button" value = "Stop" onclick = " stop (); " />  type = "button" value = "Rewind" onclick = " rewind (); " /> 

Result

Run the above command to see the result

According to Tutorialspoint

Previous article: Animation in JavaScript

Next article: Debug in JavaScript

4 ★ | 1 Vote

May be interested

  • Summary of JavaScript exercises with sample codeSummary of JavaScript exercises with sample code
    in order to make your javascript learning easier, tipsmake.com has compiled a number of javascript exercises with sample solutions for you to practice.
  • JavaScript location in HTML FileJavaScript location in HTML File
    there is flexibility in providing javascript code anywhere in an html document. however, the most preferred ways to include javascript in an html file.
  • How to Turn on JavaScriptHow to Turn on JavaScript
    javascript is a language used in many websites to provide additional functionality and access to the user. developers use javascript to deliver a large part of their site's functionality to you, the user. your browser must have javascript...
  • What is the difference between Java and JavaScript?What is the difference between Java and JavaScript?
    although the names of java and javascript seem to be related (javascript seems to be a script in java?), but that's the only similarity. these two languages ​​are not technically related to each other.
  • Void keywords in JavaScriptVoid keywords in JavaScript
    void is an important keyword in javascript that can be used as a unary operator before its single operand, which can be in any type. this operator defines an expression to be evaluated without returning a value.
  • JavaScript code to generate error charts & graphsJavaScript code to generate error charts & graphs
    the example below illustrates a sample variance chart created with javascript that incorporates a column chart. you will also get the source code for reference and editing as you wish.
  • Introduction to 2D Array - 2-dimensional array in JavaScriptIntroduction to 2D Array - 2-dimensional array in JavaScript
    in the following article, we will introduce and show you some basic operations to create and access 2-dimensional arrays - 2d array in javascript. essentially, a 2-dimensional array is a concept of a matrix of matrices - a matrix, used to store information. each 1 element contains 2 separate indexes: row (y) - column and column (x) - column.
  • Operator in JavaScriptOperator in JavaScript
    we see the following simple expression: 4 + 5 is equal to 9. here 4 and 5 are operands and '+' called operator - operator.
  • How to Disable JavaScriptHow to Disable JavaScript
    this wikihow teaches you how to turn off your web browser's javascript support. javascript is responsible for loading dynamic content in webpages, so turning it off can help websites load faster than usual. most web browsers and their...
  • Browser compatibility in JavaScriptBrowser compatibility in JavaScript
    it is extremely important to understand the differences between different web browsers to handle each one in the best way. therefore, you must know which browser your website is running from so that it can provide a suitable solution.