-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathREADME
More file actions
executable file
·92 lines (68 loc) · 3.04 KB
/
README
File metadata and controls
executable file
·92 lines (68 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
jquery.player.js
----------------
* Use javascript to control the playback of MP3s with Flash
* by: Brian Reily (brianreily.com)
* based on plugin from digitalxero.net/music/index.html
* note that the best version to use is 0.2. the code in the main
directory is in progress.
* to compile your own music.swf, you need mtasc (www.mtasc.org):
`mtasc -main music.as -swf music.swf -header 450:325:20 -version 8 -group`
* there is a test page at http://breily.github.com/jquery.player.js - note
it is very bare, but should give you an idea of how the plugin works.
Usage
-----
* first, include jquery (testing done with 1.2.6)
* then include jquery.player.js
* then (for version 0.1):
// Initialize the player object
$("#test").player("music.swf", { options });
// options you can use:
// file -> load a file and start playing immediately
// artist, title -> you can use the plugin to track these
// volume -> initial volume
// interval -> amount to change by when using volume("up"/"down")
// next_song_callback -> function to call when a song ends
// Load and play a file
$("#test").load("test.mp3", { options });
// options: artist, title (same as above)
// Control playback
$("#test").toggle(); // if playing, pause. if paused, play
$("#test").toggle("play"); // explicitly play the file
$("#test").toggle("pause"); // explicitly pause the file
$("#test").toggle("stop"); // stop playback, set position to 0
// Control the volume
$("#test").volume(); // returns current volume value
$("#test").volume("up"); // increase volume by "interval" (default is 1)
$("#test").volume("down"); // decrease volume by "interval"
$("#test").volume("mute"); // toggles mute on/off
$("#test").volume(42); // set the volume to 42
// Get information about playtime (all in seconds)
$("#test").time(); // returns current time
$("#test").time("total"); // returns the total time of the file - note that
// this increases until file is fully loaded
$("#test").time(42); // set position to 42 seconds
// Get information about bytes loaded
$("#test").bytes(); // returns number of bytes loaded
$("#test").bytes("total"); // returns the total file size, in bytes
Changes in Version 0.2
----------------------
* id3 tag support added:
$("#test").id3("TIT2")
* a full list of tags is on the Adobe Flash help docs, under Sound.id3
* useful ones:
title -> "TIT2"
artist -> "TPE1"
album -> "TALB"
track -> "TRCK"
genre -> "TCON"
* because of this, the plugin no longer tracks "artist" and "title"
* issue: there have been some problems with getting the id3 tags from some
mp3s. continues even after they finish loading - this despite other programs
verifying that they do in fact have tags.
Todo
----
Things I'm considering working on:
* Try to figure out why id3 doesn't always work.
* Perhaps combine functions into one function, for example:
$("#test").player("volume", "up");
$("#test").player("time", 42);