: mediaplayer, soundplayer, and DirectX sound. To select a method with many features and ease of use, it must belong to the mediaplayer class. The only restriction is that it depends on Windows Media Player (WMP ). However, in a Windows environment, this restriction is negligible. It is all built-in to the system, isn't it?
Of course, we can directly prevent mediaplayer operations in the window.CodeBut we encapsulate it into the musicplayer class for better normalization and maintainability.
Windows Media Player
HTML:
Javascript:
WMP. url = "" // playback media addressWMP. Controls. Play () // start playingWMP. Controls. Stop () // stop playingWMP. Controls. Pause () // pause playbackWMP. settings. Mute = true | false // controls whether to muteWMP. fullscreen = true | false // determines whether the screen is full.
Get player status
WMP. playstate // player status, which consists of 1 to 10 States, as shown below
WMP.
Windows Media Player
Html:
Javascript:
Wmp. URL = "" // playback media addressWmp. controls. play () // start playingWmp. controls. stop () // stop playingWmp. controls. pause () // pause playbackWmp. settings. mute = true | false // controls whether to muteWmp. fullScreen = true | false // determines whether the screen is full.
Get player status
Wmp. playState // player status, which consists of 1 to 10 States, as shown below
Wmp.
Hello everyone, we are here today to study the control layer of the legend of the small ten.Operation Steps
To make the structure beautiful, create a new empty node and move the Model,view,ctrl to the Ten directory:
Under the assets directory, under the new Home Code folder, create a new Ctrl,view C # script under code.
Modify the Ctrl.cs scriptAn important noun: the finite state machine is included in the toolkit provided by the game development Geek Gdgeek package.F
Well, let's start with the first part of the tutorial--the construction of music playback classes.
There are several ways to play music in WPF: MediaPlayer class, SoundPlayer class, and using DirectX sound. To choose a more functional, easy-to-use approach, it's a MediaPlayer class, and the only limitation is that you need to rely on Windows Media Player (WMP). However, in the Windows environment, this limit can be ignored, is the system itself, is not it?
Of course, we can directly control th
If (Player1.playstate = Vmpplayer. stopped)
{
Song = null;
PlayList. MoveOn (); // when the song is played to the last second, play the next one.
}
4. public static void MoveOn ()
{
If (SongList [SongIndex]! = Null SongList [SongIndex]. PlayState = SongPlayState. again)
// If the current playing song is not empty and the status is Replay
{
SongList [SongIndex]. SetSongPlayed (); // The status is changed t
Peking University Jade Bird KTV song system playing principleInstructor--Yuana Yuming1. First know there are two classes (PlayList Song)There is one method in the playlist classpublic static bool Addsong (song song){BOOL success = false;//Record added song is successfulfor (int i = 0; i {Find the first null position in the arrayif (songlist[i] = = null){Songlist[i] = song;Success = true;Break}}return success;}2. Place the selected song object into an array in the playlist classSong song = new So
Using the Window Media Player control, I made a small mp3 Player to listen to music. Is it really enjoyable? I just wrote it today. It sounds good to listen to mp3. If you have less time to talk about it, go to the topic.
Mp3 players provide the following functions:
1. Add a song. You can add a single music or all mp3 music in the specified folder including its subfolders to the playlist. 2. delete a specified song or all songs.
3. Playback control. This includes selecting the first, next, sequ
Using the Window Media Player control, I made a small mp3 Player to listen to music. Is it really enjoyable? I just wrote it today. It sounds good to listen to mp3. If you have less time to talk about it, go to the topic.Mp3 players provide the following functions:1. Add a song. You can add a single music or all mp3 music in the specified folder including its subfolders to the playlist. 2. delete a specified song or all songs.3. Playback control. This includes selecting the first, next, sequenti
;}}#endregion#region registering custom events and Parameterspublic static readonly RoutedEvent Advertpicplaystatechangedevent;public class Advertpicplayeventargs:routedeventargs{public int Playstate{GetSet}public int Playlength{GetSet}public int Playindex{GetSet}}Static Advertpiccontrol (){Advertpicplaystatechangedevent = Eventmanager.registerroutedevent ("advertpicplaystatechanged",Routingstrategy.bubble, typeof (Advertpicplaystatechangedhandler), t
Using the Window Media Player control, I made a small mp3 Player to listen to music. Is it really enjoyable? I just wrote it today. It sounds good to listen to mp3. If you have less time to talk about it, go to the topic.
Mp3 players provide the following functions:
1. Add a song. You can add a single music or all mp3 music in the specified folder including its subfolders to the playlist.2. delete a specified song or all songs.
3. Playback control. This includes selecting the first, next, seque
You can also click the button to start the timer:
// Single video playback function singlePlay (path) {QvodPlayer. url = "$ {video_path}" + path; QvodPlayer. play () ;}// function multiPlay (index) {var urls =$ ("# s _" + index) for continuous playback of multiple videos ). text (); var I = 1; if (urls! = "") {Var urlArray = urls. split (","); singlePlay (urlArray [0]); setInterval (function () {var state = QvodPlayer. playState; if (state = 0 I
In
returns the number of lost data packets (long integer)Markercount returns the number of file bookmarks (long integer)Mute returns or sets whether the control is playing the sound (logical)Openstate returns the control content source status (long integer)Playcount returns or sets the number of times a video clip is played (long integer)Playstate returns the current operation status (long integer) of the control)Previewmode returns or sets whether the
connection is successful, get the player operator interface@Override Public voidonserviceconnected (componentname name, IBinder service) {Playerinter=(Player) service; String State=playerinter.getplayerstate (); if(!state.equals ("") {btmainplaypause.settext (state); }} @Override Public voidonservicedisconnected (componentname name) {}}//Unbind at each end@Override Public voidFinish () {Super. Finish (); //Unbind the service connection at each end of activityUnbindservice (conn); Log. I ("", "d
= Dgvlist.selectedrows[0]. cells["Column3"]. Value.tostring ();Add a selected song to an arrayDyshu.addsong (song); assigning to arrays}3.//define an array of length 50, save 50 song by defaultpublic static songa[] SongList = new SONGA[50];public static int songindex = 0; The index of the currently playing song in the arrayif (player1.playstate = = WMPLib.WMPPlayState.wmppsStopped){song = null;Dyshu.mon ();}4. Then add a Timer control to the playback
); }
For detailed parameter descriptions on mcisendstring, see MSDN, or Http://blog.csdn.net/psongchao/archive/2007/01/19/1487788.aspx
5, using the AxWindowsMediaPlayer COM components to play
A. Load COM components: Toolbox->choose items->com components->windows Media Player:
B. Drag and drop the Windows Media Player control into the WinForm form, and set the URL property in AxWindowsMediaPlayer1 to MP3 or Avi's file path, F5 run.
How do I use Windows Media Player to loop through t
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.