• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PlayerListener类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.microedition.media.PlayerListener的典型用法代码示例。如果您正苦于以下问题:Java PlayerListener类的具体用法?Java PlayerListener怎么用?Java PlayerListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PlayerListener类属于javax.microedition.media包,在下文中一共展示了PlayerListener类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: playerUpdate

import javax.microedition.media.PlayerListener; //导入依赖的package包/类
public void playerUpdate(Player player, String event, Object eventData) {
    if (deleted) {
        return;
    }
    if (PlayerListener.ERROR.equals(event)) {
        lastTime = (int) (nativePlayer.getMediaTime() / 1000);
        cleanup();
    }
    if (PlayerListener.END_OF_MEDIA.equals(event)) {
        lastTime = (int) (nativePlayer.getMediaTime() / 1000);
        if (disposeOnComplete) {
            cleanup();
            if (sourceStream != null) {
                try {
                    sourceStream.close();
                } catch (Throwable t) {
                }
            }
        }
        if (onComplete != null) {
            onComplete.run();
        }
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:25,代码来源:MMAPIPlayer.java


示例2: playerUpdate

import javax.microedition.media.PlayerListener; //导入依赖的package包/类
public void playerUpdate(Player player, String event, Object eventData) {
    if(deleted) {
        return;
    }
    if(PlayerListener.ERROR.equals(event)) {
        lastTime = (int)(nativePlayer.getMediaTime() / 1000);
        cleanup();
    }
    if(PlayerListener.END_OF_MEDIA.equals(event)) {            
        lastTime = (int)(nativePlayer.getMediaTime() / 1000);
        if(disposeOnComplete){
            cleanup();
            if(sourceStream != null) {
                try {
                    sourceStream.close();
                } catch(Throwable t) {}
            }
        }
        if(onComplete != null) {
            onComplete.run();
        }
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:24,代码来源:MMAPIPlayer.java


示例3: JrFormEntryController

import javax.microedition.media.PlayerListener; //导入依赖的package包/类
public JrFormEntryController(JrFormEntryModel model, String extraKeyMode, boolean audioFailFast, boolean quickEntry, boolean isMinimal) {
    super(model);
    tryToInitDefaultLanguage(model);
    this.extraKeyMode = extraKeyMode;
    this.audioFailFast = audioFailFast;
    this.quickEntry = quickEntry;
    this.isMinimal = isMinimal;

    this.mMediaLogger = new PlayerListener() {
        public void playerUpdate(Player player, String event, Object eventData) {
            FormEntryPrompt fep = JrFormEntryController.this.getModel().getQuestionPrompt();
            try {
                if (fep != null && fep.getAudioText() != null) {
                    MediaUtils.logEvent(event, fep.getAudioText());
                }
            } catch(Exception e) {
                //Nothing
            }
        }
    };

    //#if device.identifier == Sony-Ericsson/K610i
    POUND_KEYCODE = Canvas.KEY_STAR;
    //#endif
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:26,代码来源:JrFormEntryController.java


示例4: logEvent

import javax.microedition.media.PlayerListener; //导入依赖的package包/类
/**
 * Log that a media file was started, paused, or stopped (i.e., finished playing).
 *
 * TODO: move this to some sort of 'form entry diagnostics' framework instead of bloating the logs.
 * @param event From PlayerListener
 * @param uri Media file location
 */
public static void logEvent(String event, String uri) {
    String action = "";
    if (event == PlayerListener.STARTED) {
        action = "start";
    }
    if (event == PlayerListener.STOPPED) {
        action = "pause";
    }
    else if (event == PlayerListener.END_OF_MEDIA) {
        action = "stop";
    }
    if (!"".equals(action)) {
        try {
            Vector<String> pieces = DataUtil.split(uri, "/", false);
            uri = pieces.lastElement();
        } catch (Exception e) {
            // just use the full URI
        }
        Logger.log("media", action + ": " + uri);
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:29,代码来源:MediaUtils.java


示例5: playerUpdate

import javax.microedition.media.PlayerListener; //导入依赖的package包/类
public void playerUpdate(Player player, String event, Object eventData) {
  if (event == (PlayerListener.VOLUME_CHANGED)) {
    VolumeControl vc = (VolumeControl) eventData;
  //  updateDisplay("Volume Changed to: " + vc.getLevel());
    if (vc.getLevel() > 60) {
  //    updateDisplay("Volume higher than 60 is too loud");
      vc.setLevel(60);
    }
  } else if (event == (PlayerListener.STOPPED)) {
  //  updateDisplay("Player paused at: " + (Long) eventData);
  } else if (event == (PlayerListener.STARTED)) {
  // updateDisplay("Player started at: " + (Long) eventData);
  } else if (event == (PlayerListener.END_OF_MEDIA)) {
    updateDisplay(true);
  } else if (event == (PlayerListener.CLOSED)) {
    updateDisplay(true);
  } else if (event == (PlayerListener.ERROR)) {
    updateDisplay(true);
  }
}
 
开发者ID:PropheteMath,项目名称:CrapSnap,代码行数:21,代码来源:Playerlst.java


示例6: getPlayerLoose

import javax.microedition.media.PlayerListener; //导入依赖的package包/类
public static Player getPlayerLoose(Reference reference) throws MediaException, IOException {
    Player thePlayer;

    try{
        thePlayer = Manager.createPlayer(reference.getLocalURI());
        final String uri = reference.getLocalURI();
        thePlayer.addPlayerListener(new PlayerListener() {
            public void playerUpdate(Player player, String event, Object eventData) {
                logEvent(event, uri);
            }
        });
        return thePlayer;
    } catch(MediaException e) {
        if(!FormManagerProperties.LOOSE_MEDIA_YES.equals(PropertyManager._().getSingularProperty(FormManagerProperties.LOOSE_MEDIA))) {
            throw e;
        }
        Reference[] refs = reference.probeAlternativeReferences();
        for(Reference ref : refs) {
            if(ref.doesBinaryExist()) {
                try{
                    //TODO: Make sure you create a player of the right type somehow (video/audio), don't want
                    //to accidentally send back an audio player of a video file
                    thePlayer = Manager.createPlayer(ref.getLocalURI());
                    return thePlayer;
                }catch(MediaException oe) {
                    //also bad file, keep trying
                }
            }
        }
        throw e;
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:33,代码来源:MediaUtils.java


示例7: setDisplaySize

import javax.microedition.media.PlayerListener; //导入依赖的package包/类
public void setDisplaySize(int width, int height)
    throws javax.microedition.media.MediaException {
    checkState();
    if (width < 1 || height < 1)
        throw new IllegalArgumentException("Invalid size");
    
    boolean sizeChanged = (dw != width || dh != height);
    
    if (fsmode) { // Just store sizes in fullscreen mode
        synchronized (dispBoundsLock) {
            tmpdw = width;
            tmpdh = height;
        }
    } else {
        synchronized (dispBoundsLock) {
            dw = width;
            dh = height;
        }
        scaleToDest();
        if (pvis)
            if (mmItem != null)
                mmItem.refresh(true);
            else if (cvis)                   
                canvas.repaint();
    }
    // Makes sense only if NOT in Full Screen mode
    if (sizeChanged && !fsmode)
        player.sendEvent(PlayerListener.SIZE_CHANGED, this);
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:30,代码来源:MIDPVideoRenderer.java


示例8: playerUpdate

import javax.microedition.media.PlayerListener; //导入依赖的package包/类
/**
 * PlayerListener interface's method.
 */
public void playerUpdate(Player player, String event, Object eventData) {
    if (event.equals(PlayerListener.VOLUME_CHANGED)) { // Gauge is adjusted
        actualVolume = (int) (((float) globalVolume / 100) * (float) midletVolume);
    } else if (event.equals("com.nokia.external.volume.event")) {
        // External volumes keys are pressed                
        globalVolume = Integer.parseInt(eventData.toString());
        actualVolume = (int) (((float) globalVolume / 100) * (float) midletVolume);
    }
    midlet.actualVolume = actualVolume;
    midlet.globalVolume = globalVolume;
    midlet.midletVolume = midletVolume;
    midlet.eventString = event;
    midlet.updateVolume();
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:18,代码来源:PlayerPool.java


示例9: playerUpdate

import javax.microedition.media.PlayerListener; //导入依赖的package包/类
public void playerUpdate(Player player, String event, Object eventData) {
    try {
        if (event.equals(PlayerListener.STARTED)) {
            setStatusText("Started.");
        } else if (event.equals(PlayerListener.END_OF_MEDIA)) {
            this.player.restartPlayer();
        } else if (event.equals(PlayerListener.VOLUME_CHANGED)) {
            // Volume has been changed
        }
    } catch (Exception ex) {
        exceptionOccurred(ex);
    }
}
 
开发者ID:cli,项目名称:rdio,代码行数:14,代码来源:RadioPlayerView.java


示例10: statusEvent

import javax.microedition.media.PlayerListener; //导入依赖的package包/类
public void statusEvent(String msg) {
    if (msg.equals(PlayerListener.END_OF_MEDIA)) {
        setStatusText("Connection to slow!");
    } else if (msg.equals(PlayerListener.VOLUME_CHANGED)) {
        setStatusText("Volume was changed");
    } else {
        setStatusText(msg);
    }
}
 
开发者ID:cli,项目名称:rdio,代码行数:10,代码来源:RadioPlayerView.java


示例11: restartPlayer

import javax.microedition.media.PlayerListener; //导入依赖的package包/类
public synchronized void restartPlayer() {
    try {
        fireStatusEvent("Wait...");
        IN.nextChunk();

        // Free old player
        if (player != null) {
            for (int n = 0; n < listeners.size(); n++) {
                this.player.removePlayerListener((PlayerListener) listeners.elementAt(n));
            }
            this.player.close();
            this.player = null;
        }

        fireStatusEvent("Create Player...");
        this.player = Manager.createPlayer(IN, IN.getContentType());
        this.player.realize();

        // Make sure radio is audible; this causes an VOLUME_CHANGED event
        VolumeControl vcon = (VolumeControl) this.player.getControl("VolumeControl");
        vcon.setMute(false);
        vcon.setLevel(50);

        for (int n = 0; n < listeners.size(); n++) {
            this.player.addPlayerListener((PlayerListener) listeners.elementAt(n));
        }

        fireStatusEvent("Starting...");
        this.player.start();
    } catch (Exception ex) {
        fireExecptionOccurredEvent(ex);
    }
}
 
开发者ID:cli,项目名称:rdio,代码行数:34,代码来源:RadioPlayer.java


示例12: setDisplayFullScreen

import javax.microedition.media.PlayerListener; //导入依赖的package包/类
public void setDisplayFullScreen(boolean fullScreenMode)
    throws javax.microedition.media.MediaException {
    checkState();
    if (fsmode != fullScreenMode) {
        fsmode = fullScreenMode;
        if (fsmode) { //switching from Normal to Full Screen
            synchronized (dispBoundsLock) {
                tmpdx = dx;
                tmpdy = dy;
                tmpdw = dw;
                tmpdh = dh;
            }
            if (mode == USE_DIRECT_VIDEO) {
                canvas.setFullScreenMode(true);
            } else {
                canvas = mmItem.toFullScreen(this, this);
                if (canvas == null) {
                    // No owner or no display - thus invisible
                    // Do nothing, but simulate fullscreen (lock sizes - for compliance)
                    return;
                }                        
            }
            synchronized (dispBoundsLock) {
                dx = 0;
                dy = 0;
                                    
                // Keep aspect ratio
                int scrw = canvas.getWidth();
                int scrh = canvas.getHeight();
                dw = scrh * videoWidth / videoHeight;
                if (dw > scrw) {
                    dw = scrw;
                    dh = scrw * videoHeight / videoWidth;
                    dy = (scrh - dh) / 2;
                } else {
                    dh = scrh;
                    dx = (scrw - dw) / 2;
                }
            }
            scaleToDest();
            if (cvis)
                canvas.repaint();

        } else { //switching from Full to Normal Screen
            synchronized (dispBoundsLock) {
                dx = tmpdx;
                dy = tmpdy;
                dw = tmpdw;
                dh = tmpdh;
            }
            scaleToDest();
            if (mode == USE_DIRECT_VIDEO) {
                canvas.setFullScreenMode(false);
                if (pvis && cvis)
                    canvas.repaint();
            } else {
                mmItem.toNormal();
                canvas = null;
                if (pvis)
                    mmItem.refresh(false);
            }
        }
        player.sendEvent(PlayerListener.SIZE_CHANGED, this);
    }
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:66,代码来源:MIDPVideoRenderer.java


示例13: playerUpdate

import javax.microedition.media.PlayerListener; //导入依赖的package包/类
public void playerUpdate(Player player, String string, Object object) {
if (string.equals(PlayerListener.END_OF_MEDIA)) {    release(); }
   }
 
开发者ID:BombusMod,项目名称:BombusMod,代码行数:4,代码来源:EventNotify.java



注:本文中的javax.microedition.media.PlayerListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CityModel类代码示例发布时间:2022-05-22
下一篇:
Java ITabbedPropertyConstants类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap