- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
大家好,我正在为我的 Android 设备开发媒体播放器,但不确定如何让搜索栏正常工作,而且我希望能够通过按住按钮而不是按一次来快进和快退
这是我目前所拥有的
MyMediaPlayerActivity
类:
package com.technegames.mymediaplayer;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import android.app.Activity;
import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.content.res.AssetManager;
import android.graphics.drawable.Drawable;
import android.media.AudioManager;
import android.os.Bundle;
import android.os.Environment;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;
public class MyMediaPlayerActivity extends Activity {
WakeLock wakeLock;
private static final String[] EXTENSIONS = { ".mp3", ".mid", ".wav", ".ogg", ".mp4" }; //Playable Extensions
List<String> trackNames; //Playable Track Titles
List<String> trackArtworks; //Track artwork names
AssetManager assets; //Assets (Compiled with APK)
File path; //directory where music is loaded from on SD Card
File path2; //directory where album artwork is loaded from on SD Card
Music track; //currently loaded track
ImageView bg; //Track artwork
Button btnPlay; //The play button will need to change from 'play' to 'pause', so we need an instance of it
Random random; //used for shuffle
boolean shuffle; //is shuffle mode on?
boolean isTuning; //is user currently jammin out, if so automatically start playing the next track
int currentTrack; //index of current track selected
int type; //0 for loading from assets, 1 for loading from SD card
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, "Lexiconda");
setContentView(R.layout.main);
initialize(0);
}
@Override
public void onResume(){
super.onResume();
wakeLock.acquire();
}
@Override
public void onPause(){
super.onPause();
wakeLock.release();
if(track != null){
if(track.isPlaying()){
track.pause();
isTuning = false;
btnPlay.setBackgroundResource(R.drawable.play);
}
if(isFinishing()){
track.dispose();
finish();
}
} else{
if(isFinishing()){
finish();
}
}
}
private void initialize(int type){
bg = (ImageView) findViewById(R.id.bg);
btnPlay = (Button) findViewById(R.id.btnPlay);
btnPlay.setBackgroundResource(R.drawable.play);
trackNames = new ArrayList<String>();
trackArtworks = new ArrayList<String>();
assets = getAssets();
currentTrack = 0;
shuffle = false;
isTuning = false;
random = new Random();
this.type = type;
addTracks(getTracks());
loadTrack();
}
//Generate a String Array that represents all of the files found
private String[] getTracks(){
if(type == 0){
try {
String[] temp = getAssets().list("");
return temp;
} catch (IOException e) {
e.printStackTrace();
Toast.makeText(getBaseContext(), e.getMessage(), Toast.LENGTH_LONG).show();
}
} else if(type == 1){
if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)
|| Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED_READ_ONLY)){
path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC);
path2 = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
String[] temp = path.list();
return temp;
} else{
Toast.makeText(getBaseContext(), "SD Card is either mounted elsewhere or is unusable", Toast.LENGTH_LONG).show();
}
}
return null;
}
//Adds the playable files to the trackNames List
private void addTracks(String[] temp){
if(temp != null){
for(int i = 0; i < temp.length; i++){
//Only accept files that have one of the extensions in the EXTENSIONS array
if(trackChecker(temp[i])){
trackNames.add(temp[i]);
trackArtworks.add(temp[i].substring(0, temp[i].length()-4));
}
}
Toast.makeText(getBaseContext(), "Loaded " + Integer.toString(trackNames.size()) + " Tracks", Toast.LENGTH_SHORT).show();
}
}
//Checks to make sure that the track to be loaded has a correct extenson
private boolean trackChecker(String trackToTest){
for(int j = 0; j < EXTENSIONS.length; j++){
if(trackToTest.contains(EXTENSIONS[j])){
return true;
}
}
return false;
}
//Loads the track by calling loadMusic
private void loadTrack(){
if(track != null){
track.dispose();
}
if(trackNames.size() > 0){
track = loadMusic(type);
setImage("drawable/" + trackArtworks.get(currentTrack));
}
}
//loads a Music instance using either a built in asset or an external resource
private Music loadMusic(int type){
switch(type){
case 0:
try{
AssetFileDescriptor assetDescriptor = assets.openFd(trackNames.get(currentTrack));
return new Music(assetDescriptor);
} catch(IOException e){
e.printStackTrace();
Toast.makeText(getBaseContext(), "Error Loading " + trackNames.get(currentTrack), Toast.LENGTH_LONG).show();
}
return null;
case 1:
try{
FileInputStream fis = new FileInputStream(new File(path, trackNames.get(currentTrack)));
FileDescriptor fileDescriptor = fis.getFD();
return new Music(fileDescriptor);
} catch(IOException e){
e.printStackTrace();
Toast.makeText(getBaseContext(), "Error Loading " + trackNames.get(currentTrack), Toast.LENGTH_LONG).show();
}
return null;
default:
return null;
}
}
//Sets the background image to match the track currently playing or a default image
private void setImage(String name) {
if(type == 0){
int imageResource = getResources().getIdentifier(name, null, getPackageName());
if(imageResource != 0){
Drawable image = getResources().getDrawable(imageResource);
bg.setImageDrawable(image);
} else{
int defaultImageResource = getResources().getIdentifier("drawable/defaultbg", null, getPackageName());
if(defaultImageResource != 0){
Drawable image = getResources().getDrawable(defaultImageResource);
bg.setImageDrawable(image);
}
}
} else if(type == 1){
if(new File(path2.getAbsolutePath(), trackArtworks.get(currentTrack) + ".jpg").exists()){
bg.setImageDrawable(Drawable.createFromPath(path2.getAbsolutePath() + "/" + trackArtworks.get(currentTrack) + ".jpg"));
} else{
int defaultImageResource = getResources().getIdentifier("drawable/defaultbg", null, getPackageName());
if(defaultImageResource != 0){
Drawable image = getResources().getDrawable(defaultImageResource);
bg.setImageDrawable(image);
}
}
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu){
super.onCreateOptionsMenu(menu);
createMenu(menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item){
switch(item.getItemId()){
case 0:
//Set Looping
synchronized(this){
if(track.isLooping()){
track.setLooping(false);
Toast.makeText(getBaseContext(), "Playing Tracks Sequentially", Toast.LENGTH_SHORT).show();
} else{
track.setLooping(true);
Toast.makeText(getBaseContext(), "Looping " + trackNames.get(currentTrack), Toast.LENGTH_SHORT).show();
}
}
return true;
case 1:
//Set Shuffle
synchronized(this){
if(shuffle){
setShuffle(false);
} else{
setShuffle(true);
}
}
return true;
case 2:
//Stop Music
synchronized(this){
track.switchTracks();
btnPlay.setBackgroundResource(R.drawable.play);
}
return true;
case 3:
//Change Source from Assets to SD Card and vice versa
synchronized(this){
type++;
if(type > 1){
type = 0;
}
}
if(type == 0){
Toast.makeText(getBaseContext(), "Loading Tracks from Assets ", Toast.LENGTH_SHORT).show();
} else if(type == 1){
Toast.makeText(getBaseContext(), "Loading Tracks from SD Card", Toast.LENGTH_SHORT).show();
}
initialize(type);
return true;
default:
return false;
}
}
private void createMenu(Menu menu){
MenuItem miLooping = menu.add(0, 0, 0, "Looping");{
miLooping.setIcon(R.drawable.looping);
}
MenuItem miShuffle = menu.add(0, 1, 1, "Shuffle");{
miShuffle.setIcon(R.drawable.shuffle);
}
MenuItem miStop = menu.add(0, 2, 2, "Stop");{
miStop.setIcon(R.drawable.stop);
}
MenuItem miSource = menu.add(0, 3, 3, "Source");{
miSource.setIcon(R.drawable.source);
}
}
public void click(View view){
int id = view.getId();
switch(id){
case R.id.btnPlay:
synchronized(this){
if(isTuning){
isTuning = false;
btnPlay.setBackgroundResource(R.drawable.play);
track.pause();
} else{
isTuning = true;
btnPlay.setBackgroundResource(R.drawable.pause);
playTrack();
}
}
return;
case R.id.btnPrevious:
setTrack(0);
loadTrack();
playTrack();
return;
case R.id.btnNext:
setTrack(1);
loadTrack();
playTrack();
return;
default:
return;
}
}
private void setTrack(int direction){
if(direction == 0){
currentTrack--;
if(currentTrack < 0){
currentTrack = trackNames.size()-1;
}
} else if(direction == 1){
currentTrack++;
if(currentTrack > trackNames.size()-1){
currentTrack = 0;
}
}
if(shuffle){
int temp = random.nextInt(trackNames.size());
while(true){
if(temp != currentTrack){
currentTrack = temp;
break;
}
temp++;
if(temp > trackNames.size()-1){
temp = 0;
}
}
}
}
//Plays the Track
private void playTrack(){
if(isTuning && track != null){
track.play();
Toast.makeText(getBaseContext(), "Playing " + trackNames.get(currentTrack).substring(0, trackNames.get(currentTrack).length()-4), Toast.LENGTH_SHORT).show();
}
}
//Simply sets shuffle to isShuffle and then displays a message for confirmation
private void setShuffle(boolean isShuffle) {
shuffle = isShuffle;
if(shuffle){
Toast.makeText(getBaseContext(), "Shuffle On", Toast.LENGTH_SHORT).show();
} else{
Toast.makeText(getBaseContext(), "Shuffle Off", Toast.LENGTH_SHORT).show();
}
}
}
音乐
类:
import java.io.FileDescriptor;
import java.io.IOException;
import android.content.res.AssetFileDescriptor;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
public class Music implements OnCompletionListener{
MediaPlayer mediaPlayer;
boolean isPrepared = false;
public Music(AssetFileDescriptor assetDescriptor){
mediaPlayer = new MediaPlayer();
try{
mediaPlayer.setDataSource(assetDescriptor.getFileDescriptor(), assetDescriptor.getStartOffset(), assetDescriptor.getLength());
mediaPlayer.prepare();
isPrepared = true;
mediaPlayer.setOnCompletionListener(this);
} catch(Exception ex){
throw new RuntimeException("Couldn't load music, uh oh!");
}
}
public Music(FileDescriptor fileDescriptor){
mediaPlayer = new MediaPlayer();
try{
mediaPlayer.setDataSource(fileDescriptor);
mediaPlayer.prepare();
isPrepared = true;
mediaPlayer.setOnCompletionListener(this);
} catch(Exception ex){
throw new RuntimeException("Couldn't load music, uh oh!");
}
}
public void onCompletion(MediaPlayer mediaPlayer) {
synchronized(this){
isPrepared = false;
}
}
public void play() {
if(mediaPlayer.isPlaying()){
return;
}
try{
synchronized(this){
if(!isPrepared){
mediaPlayer.prepare();
}
mediaPlayer.start();
}
} catch(IllegalStateException ex){
ex.printStackTrace();
} catch(IOException ex){
ex.printStackTrace();
}
}
public void stop() {
mediaPlayer.stop();
synchronized(this){
isPrepared = false;
}
}
public void switchTracks(){
mediaPlayer.seekTo(0);
mediaPlayer.pause();
}
public void pause() {
mediaPlayer.pause();
}
public boolean isPlaying() {
return mediaPlayer.isPlaying();
}
public boolean isLooping() {
return mediaPlayer.isLooping();
}
public void setLooping(boolean isLooping) {
mediaPlayer.setLooping(isLooping);
}
public void setVolume(float volumeLeft, float volumeRight) {
mediaPlayer.setVolume(volumeLeft, volumeRight);
}
public void dispose() {
if(mediaPlayer.isPlaying()){
stop();
}
mediaPlayer.release();
}
}
最佳答案
希望这对您有所帮助。此代码用于我们的项目
public class MusicPlayer extends Activity
implements OnCompletionListener, SeekBar.OnSeekBarChangeListener {
private ImageButton btnPlay;
private ImageButton btnForward;
private ImageButton btnBackward;
private ImageButton btnPlaylist;
private ImageButton btnRepeat;
private ImageButton btnShuffle;
private SeekBar songProgressBar;
private TextView songTitleLabel;
private TextView songCurrentDurationLabel;
private TextView songTotalDurationLabel;
// Media Player
private MediaPlayer mp;
// Handler to update UI timer, progress bar etc,.
private Handler mHandler = new Handler();;
private SongsManager songManager;
private Utilities utils;
private int seekForwardTime = 5000; // 5000 milliseconds
private int seekBackwardTime = 5000; // 5000 milliseconds
private int currentSongIndex = 0;
private boolean isShuffle = false;
private boolean isRepeat = false;
private ArrayList<HashMap<String, String>> songsList = new ArrayList<HashMap<String, String>>();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.player);
// All player buttons
btnPlay = (ImageButton) findViewById(R.id.btnPlay);
btnForward = (ImageButton) findViewById(R.id.btnForward);
btnBackward = (ImageButton) findViewById(R.id.btnBackward);
btnPlaylist = (ImageButton) findViewById(R.id.btnPlaylist);
btnRepeat = (ImageButton) findViewById(R.id.btnRepeat);
btnShuffle = (ImageButton) findViewById(R.id.btnShuffle);
songProgressBar = (SeekBar) findViewById(R.id.songProgressBar);
songTitleLabel = (TextView) findViewById(R.id.songTitle);
songCurrentDurationLabel = (TextView) findViewById(R.id.songCurrentDurationLabel);
songTotalDurationLabel = (TextView) findViewById(R.id.songTotalDurationLabel);
// Mediaplayer
mp = new MediaPlayer();
songManager = new SongsManager();
utils = new Utilities();
// Listeners
songProgressBar.setOnSeekBarChangeListener(this); // Important
mp.setOnCompletionListener(this); // Important
// Getting all songs list
songsList = songManager.getPlayList();
// By default play first song
playSong(0);
/**
* Play button click event plays a song and changes button to pause
* image pauses a song and changes button to play image
* */
btnPlay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// check for already playing
if (mp.isPlaying()) {
if (mp != null) {
mp.pause();
// Changing button image to play button
btnPlay.setImageResource(R.drawable.btn_play);
}
} else {
// Resume song
if (mp != null) {
mp.start();
// Changing button image to pause button
btnPlay.setImageResource(R.drawable.btn_pause);
}
}
}
});
btnForward.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
// get current song position
int currentPosition = mp.getCurrentPosition();
// check if seekForward time is lesser than song duration
if (currentPosition + seekForwardTime <= mp.getDuration()) {
// forward song
mp.seekTo(currentPosition + seekForwardTime);
} else {
// forward to end position
mp.seekTo(mp.getDuration());
}
return false;
}
});
/**
* Forward button click event Forwards song specified seconds
* */
btnForward.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// get current song position
// check if next song is there or not
if (currentSongIndex < (songsList.size() - 1)) {
playSong(currentSongIndex + 1);
currentSongIndex = currentSongIndex + 1;
} else {
// play first song
playSong(0);
currentSongIndex = 0;
}
}
});
btnBackward.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
int currentPosition = mp.getCurrentPosition();
// check if seekBackward time is greater than 0 sec
if (currentPosition - seekBackwardTime >= 0) {
// forward song
mp.seekTo(currentPosition - seekBackwardTime);
} else {
// backward to starting position
mp.seekTo(0);
}
return false;
}
});
/**
* Backward button click event Backward song to specified seconds
* */
btnBackward.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
if (currentSongIndex > 0) {
playSong(currentSongIndex - 1);
currentSongIndex = currentSongIndex - 1;
} else {
// play last song
playSong(songsList.size() - 1);
currentSongIndex = songsList.size() - 1;
}
}
});
/**
* Button Click event for Repeat button Enables repeat flag to true
* */
btnRepeat.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
if (isRepeat) {
isRepeat = false;
Toast.makeText(getApplicationContext(), "Repeat is OFF",
Toast.LENGTH_SHORT).show();
btnRepeat.setImageResource(R.drawable.btn_repeat);
} else {
// make repeat to true
isRepeat = true;
Toast.makeText(getApplicationContext(), "Repeat is ON",
Toast.LENGTH_SHORT).show();
// make shuffle to false
isShuffle = false;
btnRepeat.setImageResource(R.drawable.btn_repeat_focused);
btnShuffle.setImageResource(R.drawable.btn_shuffle);
}
}
});
/**
* Button Click event for Shuffle button Enables shuffle flag to true
* */
btnShuffle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
if (isShuffle) {
isShuffle = false;
Toast.makeText(getApplicationContext(), "Shuffle is OFF",
Toast.LENGTH_SHORT).show();
btnShuffle.setImageResource(R.drawable.btn_shuffle);
} else {
// make repeat to true
isShuffle = true;
Toast.makeText(getApplicationContext(), "Shuffle is ON",
Toast.LENGTH_SHORT).show();
// make shuffle to false
isRepeat = false;
btnShuffle.setImageResource(R.drawable.btn_shuffle_focused);
btnRepeat.setImageResource(R.drawable.btn_repeat);
}
}
});
/**
* Button Click event for Play list click event Launches list activity
* which displays list of songs
* */
btnPlaylist.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
Intent i = new Intent(getApplicationContext(),
PlayListActivity.class);
startActivityForResult(i, 100);
}
});
}
/**
* Receiving song index from playlist view and play the song
* */
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == 100) {
currentSongIndex = data.getExtras().getInt("songIndex");
// play selected song
playSong(currentSongIndex);
}
}
/**
* Function to play a song
*
* @param songIndex
* - index of song
* */
public void playSong(int songIndex) {
// Play song
try {
mp.reset();
mp.setDataSource(songsList.get(songIndex).get("songPath"));
mp.prepare();
mp.start();
// Displaying Song title
String songTitle = songsList.get(songIndex).get("songTitle");
songTitleLabel.setText(songTitle);
// Changing Button Image to pause image
btnPlay.setImageResource(R.drawable.btn_pause);
// set Progress bar values
songProgressBar.setProgress(0);
songProgressBar.setMax(100);
// Updating progress bar
updateProgressBar();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* Update timer on seekbar
* */
public void updateProgressBar() {
mHandler.postDelayed(mUpdateTimeTask, 100);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
if (keyCode == KeyEvent.KEYCODE_BACK) {
mHandler.removeCallbacks(mUpdateTimeTask);
mp.release();
}
return super.onKeyDown(keyCode, event);
}
/**
* Background Runnable thread
* */
private Runnable mUpdateTimeTask = new Runnable() {
public void run() {
long totalDuration = mp.getDuration();
long currentDuration = mp.getCurrentPosition();
// Displaying Total Duration time
songTotalDurationLabel.setText(""
+ utils.milliSecondsToTimer(totalDuration));
// Displaying time completed playing
songCurrentDurationLabel.setText(""
+ utils.milliSecondsToTimer(currentDuration));
// Updating progress bar
int progress = (int) (utils.getProgressPercentage(currentDuration,
totalDuration));
// System.out.println("Progress : "+progress);
songProgressBar.setProgress(progress);
// Running this thread after 100 milliseconds
mHandler.postDelayed(this, 100);
}
};
/**
*
* */
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromTouch) {
}
/**
* When user starts moving the progress handler
* */
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// remove message Handler from updating progress bar
mHandler.removeCallbacks(mUpdateTimeTask);
}
/**
* When user stops moving the progress hanlder
* */
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
mHandler.removeCallbacks(mUpdateTimeTask);
int totalDuration = mp.getDuration();
int currentPosition = utils.progressToTimer(seekBar.getProgress(),
totalDuration);
// forward or backward to certain seconds
mp.seekTo(currentPosition);
// update timer progress again
updateProgressBar();
}
/**
* On Song Playing completed if repeat is ON play same song again if shuffle
* is ON play random song
* */
@Override
public void onCompletion(MediaPlayer arg0) {
// check for repeat is ON or OFF
if (isRepeat) {
// repeat is on play same song again
playSong(currentSongIndex);
} else if (isShuffle) {
// shuffle is on - play a random song
Random rand = new Random();
currentSongIndex = rand.nextInt((songsList.size() - 1) - 0 + 1) + 0;
playSong(currentSongIndex);
} else {
// no repeat or shuffle ON - play next song
if (currentSongIndex < (songsList.size() - 1)) {
playSong(currentSongIndex + 1);
currentSongIndex = currentSongIndex + 1;
} else {
// play first song
playSong(0);
currentSongIndex = 0;
}
}
}
@Override
public void onDestroy() {
super.onDestroy();
mp.release();
}
关于java - 如何向我的媒体播放器添加 seekbar Plus 快退和快进按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15978637/
谁能详细说明以下问题? 蓝牙堆栈如何处理音频数据? 如何处理音频命令? 我们需要任何服务来处理音频数据吗? 提前致谢。 最佳答案 基本上,通过 BLE 的语音命令需要: 一些用于减少所需带宽的音频编解
我正在使用Player库以实现全屏视频播放。我相信它在幕后使用 AVFoundation。 我可以使用Float(self.player.maximumDuration)来实现视频的完整持续时间。但是
我正在制作一种宏记录器/播放器 我已经使用 java.awt.Robot() 等实用程序完成播放器部分,它模拟基本的人类鼠标/键盘输出命令,读取 XML 文件。 我卡在了必须记录该 XML 文件的部分
我目前有以下代码可以在页面上播放 youtube 视频。 //Load player api asynchronously. var tag = document.createElement('s
我需要提供音频内容(但不是音乐,更像是播客;人类语音),我正在考虑使用基于 Flash 的播放器让用户无需下载即可收听内容。 我需要一个免费的可嵌入 Flash 的 mp3 播放器。有什么建议? 因为
html5 player/api 更新了吗?事件 SC.Widget.Events.PLAY, SC.Widget.Events.PAUSE, SC.Widget.Events.FINISH, htm
我想在 Lubuntu VMware 中自动打开和关闭 vlc 播放器。我试过一个shell脚本代码,如: vlc rtmp://code sleep(5) exit 0 or vl
我有一个只支持纵向模式的应用程序,它有一个表格,每个单元格包含一个标题和一个带有 YouTube 视频的 web View 。 现在您将如何让 Youtube 播放器同时处于横向和纵向模式?
我正在尝试在我的应用程序中使用 YouTube 播放器 API,但我不知道如何确定视频是否为直播。如果有人知道如何获得视频的真实持续时间。 更新: 我想出了一种方法来确定内容是否是实时的,我使用我的后
我想创建一个能够播放 YouTube 视频的音频并将下载的内容保存在本地缓存中的应用程序,因此当用户决定恢复或再次播放视频时,它不必再次下载部分视频而只需下载剩余部分(用户可以决定如何处理缓存,以及如
我希望我的页面将 div 显示为模态,然后播放 YouTube 视频。我能够按预期播放视频(下面的代码),但是当我在过滤操作时切换到隐藏的 div 时,页面加载时隐藏的 div 不会将 data-sr
我正在尝试使用 AngularJS 和 WP API 构建 SPA。我使用部分在 ng-view 中加载我需要通过路由显示的所有内容。在此基础上,我添加了 Plangular,它是一个使用 Sound
我找到了一个不错的 HTML 5 音频播放器,它带有基于 plyr 的播放列表和艺术品。它在我的桌面浏览器上运行良好,但在我的移动设备 (iOS) 上,按播放后无法播放。有一个codepen来演示:
我正在尝试通过pyglet在Python 3中播放歌曲。我可以播放和停止播放一首歌曲,但是当我尝试播放下一首歌曲时会产生错误。 I followed these instructions.我将在tki
如何将嵌入的 Vimeo 视频重置为播放完毕后的加载状态? Vimeo API 提供了卸载方法 player.api("unload") 但它不适用于非 Flash 播放器。 最佳答案 使用Vimeo
我有一个用于音频录制和播放的网络应用程序。为此,我正在使用 html5 播放器。 现在我必须开发 Phonegap Android 应用程序。我已将插件(org.apache.cordova.medi
有人知道如何像 SuperFlix 一样将自己的字幕加载到 Netflix 播放器吗?关于 Netflix HTML5 播放器的信息很少,其中之一是我应该可以使用 操作播放器 netflix.cadm
如何将新的黑色 YouTube 播放器嵌入到我的网站(刚刚推出的网站)中? 我以前曾问过这个问题,但它已关闭,因为在投票否决和关闭之前没有人愿意真正阅读该问题。不,我没有问如何嵌入V2或V3播放器,我
几个小时以来,我一直在尝试添加一种打开我的 mp3 文件的方法并在队列中一一打开它们。但我不知道该怎么做。当涉及到单个文件时,我打开并播放不是问题。所以我正在考虑 Media(JavaFX) 类中的线
我知道这个函数 (setFullscreen) 只适用于 HTML5,但它对我不起作用。这是我使用的方式: setFullscreen: true 我希望 JW Player 在页面加载后立即以全屏模
我是一名优秀的程序员,十分优秀!