8/6/2023 0 Comments Older versions of realplayerIn function butStop_onclick(), we stop the playing of the clip using the DoStop() method of the RealPlayer object. Next we use the DoPlay() method of the RealPlayer object, which starts the playing of the source file. This method takes one parameter-the file that we want the RealPlayer plug-in to load. In the butPlay_onclick() function, we use the SetSource() method of the RealPlayer object. The script will work with IE and NN, though under IE it's accessing the ActiveX control defined in, and in NN it's accessing the plug-in defined in the tag. In both functions, we access the RealPlayer control by using its name prefixed with document. We use one function to load the file the user selected and play it, and the other function to stop play. In the other two functions, we access the RealPlayer plug-in or control that we embedded in the page. In reality we would perform checks to see whether the file type selected by the user is actually a valid sound file. The onblur event will fire whenever the user moves focus from the file control to another control or area of the page. ![]() In other words, fileName will contain the name and path of the file the user has chosen to play. In the function file1_onblur(), we set a global variable, fileName, to the value of the file control. We've connected the two buttons' onclick event handlers and the file control's onblur event handler to three functions, butPlay_onclick(), butStop_onclick(), and file1_onblur(), which are defined in the script block in the head of the page. When chosen, this file's name appears in the text box. When the button is clicked, a Choose File dialog box opens, allowing you to choose the. This means that a text box and a button are displayed. The first two of these are just standard buttons, but the last is a element of type="file". The form in the body of the page contains three form elements. ra ( spacemusic.ra is provided with the code download, or you can create your own with Real Producer Basic, also available from Click the Play Sound and Stop Sound buttons to play and stop the sound. We also add a form with buttons for starting, stopping, and choosing a sound file to the body of the page.Ĭlick the Browse button and browse to a sound file with the extension. We'll do this by adding a function to check for the availability of the plug-in or control and attaching this to the window object's onload event handler in the tag. So let's redirect them to another page if they do not have the right plug-in or control. We want to make sure that users without the RealPlayer plug-in or control don't see error messages when we start scripting the controls. This will display a message to such users telling them why they are staring at a blank page! By placing it inside the head of the document, it becomes invisible to the user.įinally, we've put a tag inside the body of the page for users of browsers that don't support plug-ins or ActiveX controls. Well, for this example we don't want to display the graphical interface of the control itself instead we just want to use its ability to play sounds. This means that if we placed the tag outside the tags, IE would recognize both the and tags and get confused, particularly over the id values because both have the same id of real1. IE does support the tag, though its use is discouraged. IE, on the other hand, will ignore the tag inside the tags, but IE will display the ActiveX control. ![]() The reason for this is that NN will ignore the tags and just display the plug-in defined in the tag. The first thing to note is that the tag for the NN plug-in has been inserted in between the opening tag and closing tag. This Page requires a browser supporting Plug-ins or ActiveX controls You can find more information on this control from devzone/index.html, and there is a free version (RealOne Player) that can be downloaded from Note that a version you can pay for with more features is provided, but if you search the website, a no-charge basic version is available.įirst we need to embed the control in a web page. The actual properties, methods, and events supported by a plug-in or control will be specific to that control, but let's look at one of the more commonly available controls, RealNetworks' RealPlayer, which comes in both plug-in form for NN and ActiveX control form for IE. We can then access the corresponding object's methods, properties, and events just as we would for any other tag. Inside the or tag, we give our plug-in or control a unique id value. However, it's important to check the developer's documentation because it's likely that there will be some differences. To make life easier for us, most developers of plug-ins and controls make the properties, methods, and events supported by the plug-in and ActiveX control similar. Once we have the plug-ins or ActiveX controls embedded into the page, their actual use is very similar.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |