/**
 * @brief Toggle media playback
 *
 * If it is currently playing, pause playback. If it is currently paused,
 * start playback.
 *
 * @sa gtk_vlc_player_play
 * @sa gtk_vlc_player_pause
 *
 * @param player \e GtkVlcPlayer instance
 * @return \c TRUE if media is playing \b after the operation,
 *         \c FALSE if it is paused.
 */
gboolean
gtk_vlc_player_toggle(GtkVlcPlayer *player)
{
	if (libvlc_media_player_is_playing(player->priv->media_player))
		gtk_vlc_player_pause(player);
	else
		gtk_vlc_player_play(player);

	return (gboolean)libvlc_media_player_is_playing(player->priv->media_player);
}
Esempio n. 2
0
void player::play() {
    if (!mp) { //if player is not load with media
        dataObject ob;
        ob.object = "player";
        ob.msg = "media_explorer_media";
        Notify(ob);
        return;
    }

    if (libvlc_media_player_is_playing(mp)) { //if current playing
        /* Pause */
//        libvlc_media_player_pause(mp);
        dataObject ob;
        ob.object = "player";
        ob.msg = "play";
//        Notify(ob);
    } else { //if not playing
        /* Play again */
        dataObject ob;
        ob.object = "player";
        ob.msg = "pause";
//        Notify(ob);
        libvlc_media_player_play(mp);
    }
}
Esempio n. 3
0
bool player::isPLay() {
    if (mp == NULL) { // if player is nnit initialise return false
        return false;
    } else { // if player is initialise return the whether is somethings playing
        return libvlc_media_player_is_playing(mp);
    }
}
Esempio n. 4
0
void VLCMainwindow::openFile() {
    /* Just the basic file-select box */
    QString fileOpen = QFileDialog::getOpenFileName(this,tr("Load a file"), "~");
    fileOpen.replace("/", "\\");
    /* Stop if something is playing */
    if( vlcPlayer && libvlc_media_player_is_playing(vlcPlayer) )
        stop();

    /* New Media */
    libvlc_media_t *vlcMedia = libvlc_media_new_path(vlcObject,qtu(fileOpen));
    if( !vlcMedia )
        return;
    vlcPlayer = libvlc_media_player_new_from_media (vlcMedia);
    libvlc_media_release(vlcMedia);

    /* Integrate the video in the interface */
#if defined(Q_OS_MAC)
    libvlc_media_player_set_nsobject(vlcPlayer, videoWidget->winId());
#elif defined(Q_OS_UNIX)
    libvlc_media_player_set_xwindow(vlcPlayer, videoWidget->winId());
#elif defined(Q_OS_WIN)
    libvlc_media_player_set_hwnd(vlcPlayer, videoWidget->winId());
#endif

    //int windid = videoWidget->winId();
    //libvlc_media_player_set_xwindow (vlcPlayer, windid );

    /* And play */
    libvlc_media_player_play (vlcPlayer);

    //Set vars and text correctly
    playBut->setText("Pause");
}
Esempio n. 5
0
void Mwindow::openFile() {

    /* The basic file-select box */
    QString fileOpen = QFileDialog::getOpenFileName(this, tr("Load a file"), "~");

    /* Stop if something is playing */
    if (vlcPlayer && libvlc_media_player_is_playing(vlcPlayer))
        stop();

    /* Create a new Media */
    libvlc_media_t *vlcMedia = libvlc_media_new_path(vlcInstance, qtu(fileOpen));
    if (!vlcMedia)
        return;

    /* Create a new libvlc player */
    vlcPlayer = libvlc_media_player_new_from_media (vlcMedia);

    /* Release the media */
    libvlc_media_release(vlcMedia);

    /* Integrate the video in the interface */
#if defined(Q_OS_MAC)
    libvlc_media_player_set_nsobject(vlcPlayer, (void *)videoWidget->winId());
#elif defined(Q_OS_UNIX)
    libvlc_media_player_set_xwindow(vlcPlayer, videoWidget->winId());
#elif defined(Q_OS_WIN)
    libvlc_media_player_set_hwnd(vlcPlayer, videoWidget->winId());
#endif

    /* And start playback */
    libvlc_media_player_play (vlcPlayer);

    /* Update playback button */
    playBut->setText("Pause");
}
void VlcVideoWidget::Play() 
{
    if (!vlcPlayer_)
        return;
    if (!libvlc_media_player_is_playing(vlcPlayer_))
        libvlc_media_player_play(vlcPlayer_);
}
Esempio n. 7
0
gboolean
xmr_player_playing(XmrPlayer *player)
{
	g_return_val_if_fail(player != NULL, FALSE);
	
	return libvlc_media_player_is_playing(player->priv->player) == 1;
}
Esempio n. 8
0
void VlcWidget::disableScreenSaver ()
{
    auto e = Util::MakeEntity ("ScreensaverProhibition", {}, {}, "x-leechcraft/power-management");
    e.Additional_ ["ContextID"] = "org.vtyulc.VlcTab";
    e.Additional_ ["Enable"] = libvlc_media_player_is_playing (VlcPlayer_->GetPlayer ().get ());

    Proxy_->GetEntityManager ()->HandleEntity (e);
}
Esempio n. 9
0
jboolean Java_org_videolan_libvlc_LibVLC_isPlaying(JNIEnv *env, jobject thiz)
{
    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
    if (mp)
        return !!libvlc_media_player_is_playing(mp);
    else
        return 0;
}
Esempio n. 10
0
void MainWindow::OnPlayPause(wxCommandEvent& event) {
    if(libvlc_media_player_is_playing(media_player) == 1) {
        pause();
    }
    else {
        play();
    }
}
Esempio n. 11
0
bool CAVPlayer::IsPlaying()
{
    if (m_pVLC_Player)
    {
        return (1 == libvlc_media_player_is_playing(m_pVLC_Player));
    }

    return false;
}
Esempio n. 12
0
int VLCWrapperImpl::isPlaying()
{
	int nRet = 0;
	if ( m_pMediaPlayer )
	{
		nRet = libvlc_media_player_is_playing(m_pMediaPlayer, &m_VLCex);
		ProcessVLCException(&m_VLCex, m_EH);
	}
	return nRet;
}
Esempio n. 13
0
jboolean
Java_org_videolan_libvlc_MediaPlayer_isPlaying(JNIEnv *env, jobject thiz)
{
    vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);

    if (!p_obj)
        return false;

    return !!libvlc_media_player_is_playing(p_obj->u.p_mp);
}
Esempio n. 14
0
void VlcVideoPlayer::playPause()
{
    if (firstPlay_)
    {
        libvlc_media_player_play(vlcPlayer);
        firstPlay_ = !firstPlay_;
    }

    libvlc_media_player_set_pause(vlcPlayer, libvlc_media_player_is_playing(vlcPlayer));
}
Esempio n. 15
0
void NPlaybackEngineVlc::play()
{
    if (!hasMedia())
        return;

    if (!libvlc_media_player_is_playing(m_mediaPlayer))
        libvlc_media_player_play(m_mediaPlayer);
    else
        pause();
}
Esempio n. 16
0
int qtVlc::isPlaying()
{
    if(mUrl != "")
    {
        return libvlc_media_player_is_playing(mp);
    }
    else
    {
        return false;
    }
}
Esempio n. 17
0
bool VlcControl::isPlaying()
{
    if(libvlc_media_player_is_playing(vlcPlayer))
    {
        return TRUE;
    }
    else
    {
        return FALSE;
    }
}
void VLCVideoTextureObjChunk::updateTime(void)
{
    if ((libvlc == NULL) || (vlcmediaplayer == NULL)) return;    
    if (libvlc_media_player_is_playing(vlcmediaplayer)!=1) return;
    // only update if > MIN_TIME_DIFF ms offset
    long test=labs(libvlc_media_player_get_time(vlcmediaplayer)-this->getTimestamp());
    if (test>MIN_TIME_DIFF)
    {
        libvlc_media_player_set_time(vlcmediaplayer, this->getTimestamp());
        SLOG << "resyncing video: " << test << std::endl;
    }
}
Esempio n. 19
0
STDMETHODIMP VLCPlaylist::get_isPlaying(VARIANT_BOOL* isPlaying)
{
    if( NULL == isPlaying )
        return E_POINTER;

    libvlc_media_player_t *p_md;
    HRESULT hr = getMD(&p_md);
    if( SUCCEEDED(hr) )
    {
        *isPlaying = varbool( libvlc_media_player_is_playing(p_md) );
    }
    return hr;
};
Esempio n. 20
0
int libvlc_pause(int nameId)
{
  int result = 0;

  CHECK_NAMEID(nameId);
  if (libvlc_media_player_is_playing(soundPlay[nameId]) == 0) {
    result = libvlc_media_player_play(soundPlay[nameId]);
  } else {
    libvlc_media_player_pause(soundPlay[nameId]);
  }

  return result;
}
void VLCVideoTextureObjChunk::resizeVideo()
{
    if ((libvlc == NULL) || (vlcmediaplayer == NULL)) return;    
    libvlc_time_t current_time=0;
    bool play = true;

    if (libvlc_media_player_is_playing(vlcmediaplayer)!=1) play=false;
    
    current_time = libvlc_media_player_get_time(vlcmediaplayer);           
    SINFO << "restart video at " << current_time << std::endl;
        
    createVLCInstance(current_time,play);
}
Esempio n. 22
0
void player::pause() {
    //    libvlc_media_player_set_pause(mp,pause());
    //  pause();
    if (mp && libvlc_media_player_is_playing(mp)) {// if player is initialize pause player        
        libvlc_media_player_pause(mp);
        dataObject ob;
        ob.object = "player";
        ob.msg = "play";
//        Notify(ob);
    } else {
//        exit(EXIT_FAILURE);
    }
}
Esempio n. 23
0
bool VlcVideoWidget::Seek(s64 time)
{
    if (vlcPlayer_)
    {
        if (libvlc_media_player_is_playing(vlcPlayer_))
        {
            if (libvlc_media_player_is_seekable(vlcPlayer_))
            {
                libvlc_media_player_set_time(vlcPlayer_, time);
                return true;
            }
        }
    }
    return false;
}
Esempio n. 24
0
void VLCMainwindow::play() {

    if(vlcPlayer)
    {
        if (libvlc_media_player_is_playing(vlcPlayer))
        {
            libvlc_media_player_pause(vlcPlayer);
            playBut->setText("Play");
        }
        else
        {
            libvlc_media_player_play(vlcPlayer);
            playBut->setText("Pause");
        }
    }
}
Esempio n. 25
0
bool VlcVideoWidget::TogglePlay()
{
    statusAccess.lock();
    bool stoppedNow = status.stopped;
    statusAccess.unlock();
    if (stoppedNow)
    {
        Play();
        return true;
    }
    else
    {
        Pause();
        return (libvlc_media_player_is_playing(vlcPlayer_) > 0 ? true : false);
    }
}
void VLCVideoTextureObjChunk::checkForSync(void)
{
    if ((libvlc == NULL) || (vlcmediaplayer == NULL)) return;    
    if (libvlc_media_player_is_playing(vlcmediaplayer)!=1) return;

    // only the master sets the timestamp
    if (getIsMaster()==true) 
    {
        OSG::TimeStamp now = OSG::getTimeStamp();
        if (OSG::getTimeStampMsecs(now-lastSync) > getUpdatefreq()) 
        {
            lastSync=now;
            setTimestamp(libvlc_media_player_get_time(vlcmediaplayer)+NETWORK_LATENCY);
            commitChanges();
        }
    }
}
Esempio n. 27
0
void Mwindow::play() {
    if (!vlcPlayer)
        return;

    if (libvlc_media_player_is_playing(vlcPlayer))
    {
        /* Pause */
        libvlc_media_player_pause(vlcPlayer);
        playBut->setText("Play");
    }
    else
    {
        /* Play again */
        libvlc_media_player_play(vlcPlayer);
        playBut->setText("Pause");
    }
}
Esempio n. 28
0
bool VLCVideoWrapper::isPlaying(void) const
{

    bool error(false);
    // check if media player is playing 
    int playing = libvlc_media_player_is_playing(_MediaPlayer);
    // check for errors
    error = checkVLCError("checking play state");
    if(!error)
    {	// returns true if the media is playing
        return ((playing > 0)?(true):(false));
    } 
    else
    {
        return false;
    }
}
Esempio n. 29
0
void PlayerEngine_vlc::get_File(std::string uri){
 /* Stop if something is playing */
    if (vlcPlayer && libvlc_media_player_is_playing(vlcPlayer))
        stopState();
    message =  "Status : Loading";
    
     /* Create a new Media */
    libvlc_media_t *vlcMedia = libvlc_media_new_path(vlcInstance,&uri[0]/*uri.c_str()*/);
    if (!vlcMedia)
     { 
       message =  "Error : failed to create media";
        return;
    }
    
     /* Create a new libvlc player */
    vlcPlayer = libvlc_media_player_new_from_media (vlcMedia);

    //gulong window_id;
  //libvlc_media_player_set_xwindow(vlcPlayer,window_id);
  
  //Player_ControlsGUI win;

  //win.set_xwindows_id(window_id);    





    /* Release the media */
    libvlc_media_release(vlcMedia);

    /* And start playback */
     /*
    libvlc_media_player_play (vlcPlayer);
    message =  "Status : Playing";
      */


// catch the exception from here

    


}
Esempio n. 30
0
void PlayerEngine_vlc::playState(){

	  if (!vlcPlayer)
        return;

    if (libvlc_media_player_is_playing(vlcPlayer))
    {
        /* Pause */
        libvlc_media_player_pause(vlcPlayer);
       
    }
    else
    {
        /* Play again */
        libvlc_media_player_play(vlcPlayer);
     
    }

}