×
Namespaces

Variants
Actions
Revision as of 02:42, 13 August 2012 by hamishwillee (Talk | contribs)

Archived:Using embedded flash object to play sounds in a Symbian WRT widget

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: Maveric (27 Oct 2010)
Last edited: hamishwillee (13 Aug 2012)

Under construction.

Contents

Introduction

The purpose of this wiki article is to demonstrate how you can play sounds in a Symbian WRT widget using embedded Flash object.


Prerequisites

  • Any code editor of your choise. Notepad++ is very popular among the user as a text editor which gives syntax highligthing.
  • A supported device for testing, N97 is used in this example.

Example code

This example code shows how to perform the actual embedding and playing, and can be found as a full widget attached to this article.

basic.js - code for WRT default JavaScript file

Note: Editing this file is not necessary for this example, you can leave it as is.


index.html - code for WRT default HTML-file

In the CSS file basic.css will simply define a background-color and text alignment to the middle of the widget.

The Flash media content placeholder will be embedded into the widget as an object, then the embed tags make this understood by the S60 browser so it can execute the content on the device.

The screen height and size can be adjusted accordingly, here the figures are just for testing on an N97 device.

First part of the code is for embedding a flash animation/video, you can use both elements as there are example files added as ".swf" and ".mp3". In the example, the animation/movie is commented out and only the mp3 object part will be executed. You can test with these both, same time or separately by uncommenting the first section.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Embed FLASH example</title>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8" />
<script language="javascript" type="text/javascript" src="basic.js"></script>
<style type="text/css">
@import "basic.css";
</style>
</head>
<body onLoad="javascript:init();">
</body>
 
 
<!--MOVIE
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
width="240" height "320" id="player" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="test.swf" />
<param name="loop" value="false" />
<param name="menu" value="false" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="bgcolor" value="#6C5635" />
<embed src="test.swf" loop="false" menu="false" quality="high" wmode="opaque" bgcolor="#6C5635" width="240" height="320" name="downcount" align="middle" allowScriptAccess="sameDomain" type="application/x-schockwave-flash" pluginspage="http://get.adobe.com/flashplayer/otherversions/" />
-->

This second part of the example code in the HTML file will be executed.

<!--MP3-->
<center>
MP3 PLAYER DEMO
<p>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
width="240" height "200" id="player" align="middle">
<param name="movie" value="player_mp3.swf?mp3=test.mp3">
<param name="wmode" value="transparent">
<param name="loop" value="false" />
<param name="menu" value="true" />
<param name="quality" value="high" />
<param name="bgcolor" value="#6C5635" />
<embed src="player_mp3.swf?mp3=test.mp3" loop="false" menu="false"
quality="high" wmode="opaque" bgcolor="#6C5635" width="240" height="200"
name="player" align="middle" allowScriptAccess="sameDomain"
type="application/x-schockwave-flash" pluginspage="http://get.adobe.com/flashplayer/otherversions/" />
</object>
</html>
</center>
</p>

Media file and link for testing

test.mp3

Media:test.mp3

test.swf

Media:test.mp3

player.swf

Media:test.mp3

45 page views in the last 30 days.
×