-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
/
PlayerBuiltins.cpp
624 lines (573 loc) · 24.8 KB
/
PlayerBuiltins.cpp
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
/*
* Copyright (C) 2005-2018 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#include "PlayerBuiltins.h"
#include "Application.h"
#include "FileItem.h"
#include "ServiceBroker.h"
#include "filesystem/Directory.h"
#include "guilib/GUIComponent.h"
#include "guilib/GUIWindowManager.h"
#include "GUIUserMessages.h"
#include "PartyModeManager.h"
#include "PlayListPlayer.h"
#include "SeekHandler.h"
#include "settings/MediaSettings.h"
#include "settings/Settings.h"
#include "settings/SettingsComponent.h"
#include "storage/MediaManager.h"
#include "utils/FileExtensionProvider.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
#include "view/GUIViewState.h"
#include "video/windows/GUIWindowVideoBase.h"
#include "pvr/channels/PVRChannel.h"
#include "pvr/recordings/PVRRecording.h"
#include <math.h>
#ifdef HAS_DVD_DRIVE
#include "Autorun.h"
#endif
/*! \brief Clear current playlist
* \param params (ignored)
*/
static int ClearPlaylist(const std::vector<std::string>& params)
{
CServiceBroker::GetPlaylistPlayer().Clear();
return 0;
}
/*! \brief Start a playlist from a given offset.
* \param params The parameters.
* \details params[0] = Position in playlist or playlist type.
* params[1] = Position in playlist if params[0] is playlist type (optional).
*/
static int PlayOffset(const std::vector<std::string>& params)
{
// playlist.playoffset(offset)
// playlist.playoffset(music|video,offset)
std::string strPos = params[0];
std::string paramlow(params[0]);
StringUtils::ToLower(paramlow);
if (params.size() > 1)
{
// ignore any other parameters if present
std::string strPlaylist = params[0];
strPos = params[1];
int iPlaylist = PLAYLIST_NONE;
if (paramlow == "music")
iPlaylist = PLAYLIST_MUSIC;
else if (paramlow == "video")
iPlaylist = PLAYLIST_VIDEO;
// unknown playlist
if (iPlaylist == PLAYLIST_NONE)
{
CLog::Log(LOGERROR,"Playlist.PlayOffset called with unknown playlist: %s", strPlaylist.c_str());
return false;
}
// user wants to play the 'other' playlist
if (iPlaylist != CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist())
{
g_application.StopPlaying();
CServiceBroker::GetPlaylistPlayer().Reset();
CServiceBroker::GetPlaylistPlayer().SetCurrentPlaylist(iPlaylist);
}
}
// play the desired offset
int pos = atol(strPos.c_str());
// playlist is already playing
if (g_application.GetAppPlayer().IsPlaying())
CServiceBroker::GetPlaylistPlayer().PlayNext(pos);
// we start playing the 'other' playlist so we need to use play to initialize the player state
else
CServiceBroker::GetPlaylistPlayer().Play(pos, "");
return 0;
}
/*! \brief Control player.
* \param params The parameters
* \details params[0] = Control to execute.
* params[1] = "notify" to notify user (optional, certain controls).
*/
static int PlayerControl(const std::vector<std::string>& params)
{
g_application.ResetScreenSaver();
g_application.WakeUpScreenSaverAndDPMS();
std::string paramlow(params[0]);
StringUtils::ToLower(paramlow);
if (paramlow == "play")
{ // play/pause
// either resume playing, or pause
if (g_application.GetAppPlayer().IsPlaying())
{
if (g_application.GetAppPlayer().GetPlaySpeed() != 1)
g_application.GetAppPlayer().SetPlaySpeed(1);
else
g_application.GetAppPlayer().Pause();
}
}
else if (paramlow == "stop")
{
g_application.StopPlaying();
}
else if (StringUtils::StartsWithNoCase(params[0], "frameadvance"))
{
std::string strFrames;
if (params[0].size() == 12)
CLog::Log(LOGERROR, "PlayerControl(frameadvance(n)) called with no argument");
else if (params[0].size() < 15) // arg must be at least "(N)"
CLog::Log(LOGERROR, "PlayerControl(frameadvance(n)) called with invalid argument: \"%s\"", params[0].substr(13).c_str());
else
strFrames = params[0].substr(13);
StringUtils::TrimRight(strFrames, ")");
float frames = (float) atof(strFrames.c_str());
g_application.GetAppPlayer().FrameAdvance(frames);
}
else if (paramlow =="rewind" || paramlow == "forward")
{
if (g_application.GetAppPlayer().IsPlaying() && !g_application.GetAppPlayer().IsPaused())
{
float playSpeed = g_application.GetAppPlayer().GetPlaySpeed();
if (paramlow == "rewind" && playSpeed == 1) // Enables Rewinding
playSpeed *= -2;
else if (paramlow == "rewind" && playSpeed > 1) //goes down a notch if you're FFing
playSpeed /= 2;
else if (paramlow == "forward" && playSpeed < 1) //goes up a notch if you're RWing
{
playSpeed /= 2;
if (playSpeed == -1)
playSpeed = 1;
}
else
playSpeed *= 2;
if (playSpeed > 32 || playSpeed < -32)
playSpeed = 1;
g_application.GetAppPlayer().SetPlaySpeed(playSpeed);
}
}
else if (paramlow =="tempoup" || paramlow == "tempodown")
{
if (g_application.GetAppPlayer().SupportsTempo() &&
g_application.GetAppPlayer().IsPlaying() && !g_application.GetAppPlayer().IsPaused())
{
float playTempo = g_application.GetAppPlayer().GetPlayTempo();
if (paramlow == "tempodown")
playTempo -= 0.1f;
else if (paramlow == "tempoup")
playTempo += 0.1f;
g_application.GetAppPlayer().SetTempo(playTempo);
}
}
else if (paramlow == "next")
{
g_application.OnAction(CAction(ACTION_NEXT_ITEM));
}
else if (paramlow == "previous")
{
g_application.OnAction(CAction(ACTION_PREV_ITEM));
}
else if (paramlow == "bigskipbackward")
{
if (g_application.GetAppPlayer().IsPlaying())
g_application.GetAppPlayer().Seek(false, true);
}
else if (paramlow == "bigskipforward")
{
if (g_application.GetAppPlayer().IsPlaying())
g_application.GetAppPlayer().Seek(true, true);
}
else if (paramlow == "smallskipbackward")
{
if (g_application.GetAppPlayer().IsPlaying())
g_application.GetAppPlayer().Seek(false, false);
}
else if (paramlow == "smallskipforward")
{
if (g_application.GetAppPlayer().IsPlaying())
g_application.GetAppPlayer().Seek(true, false);
}
else if (StringUtils::StartsWithNoCase(params[0], "seekpercentage"))
{
std::string offset;
if (params[0].size() == 14)
CLog::Log(LOGERROR,"PlayerControl(seekpercentage(n)) called with no argument");
else if (params[0].size() < 17) // arg must be at least "(N)"
CLog::Log(LOGERROR,"PlayerControl(seekpercentage(n)) called with invalid argument: \"%s\"", params[0].substr(14).c_str());
else
{
// Don't bother checking the argument: an invalid arg will do seek(0)
offset = params[0].substr(15);
StringUtils::TrimRight(offset, ")");
float offsetpercent = (float) atof(offset.c_str());
if (offsetpercent < 0 || offsetpercent > 100)
CLog::Log(LOGERROR,"PlayerControl(seekpercentage(n)) argument, %f, must be 0-100", offsetpercent);
else if (g_application.GetAppPlayer().IsPlaying())
g_application.SeekPercentage(offsetpercent);
}
}
else if (paramlow == "showvideomenu")
{
if( g_application.GetAppPlayer().IsPlaying() )
g_application.GetAppPlayer().OnAction(CAction(ACTION_SHOW_VIDEOMENU));
}
else if (StringUtils::StartsWithNoCase(params[0], "partymode"))
{
std::string strXspPath;
//empty param=music, "music"=music, "video"=video, else xsp path
PartyModeContext context = PARTYMODECONTEXT_MUSIC;
if (params[0].size() > 9)
{
if (params[0].size() == 16 && StringUtils::EndsWithNoCase(params[0], "video)"))
context = PARTYMODECONTEXT_VIDEO;
else if (params[0].size() != 16 || !StringUtils::EndsWithNoCase(params[0], "music)"))
{
strXspPath = params[0].substr(10);
StringUtils::TrimRight(strXspPath, ")");
context = PARTYMODECONTEXT_UNKNOWN;
}
}
if (g_partyModeManager.IsEnabled())
g_partyModeManager.Disable();
else
g_partyModeManager.Enable(context, strXspPath);
}
else if (paramlow == "random" || paramlow == "randomoff" || paramlow == "randomon")
{
// get current playlist
int iPlaylist = CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist();
// reverse the current setting
bool shuffled = CServiceBroker::GetPlaylistPlayer().IsShuffled(iPlaylist);
if ((shuffled && paramlow == "randomon") || (!shuffled && paramlow == "randomoff"))
return 0;
// check to see if we should notify the user
bool notify = (params.size() == 2 && StringUtils::EqualsNoCase(params[1], "notify"));
CServiceBroker::GetPlaylistPlayer().SetShuffle(iPlaylist, !shuffled, notify);
// save settings for now playing windows
switch (iPlaylist)
{
case PLAYLIST_MUSIC:
CMediaSettings::GetInstance().SetMusicPlaylistShuffled(CServiceBroker::GetPlaylistPlayer().IsShuffled(iPlaylist));
CServiceBroker::GetSettingsComponent()->GetSettings()->Save();
break;
case PLAYLIST_VIDEO:
CMediaSettings::GetInstance().SetVideoPlaylistShuffled(CServiceBroker::GetPlaylistPlayer().IsShuffled(iPlaylist));
CServiceBroker::GetSettingsComponent()->GetSettings()->Save();
default:
break;
}
// send message
CGUIMessage msg(GUI_MSG_PLAYLISTPLAYER_RANDOM, 0, 0, iPlaylist, CServiceBroker::GetPlaylistPlayer().IsShuffled(iPlaylist));
CServiceBroker::GetGUI()->GetWindowManager().SendThreadMessage(msg);
}
else if (StringUtils::StartsWithNoCase(params[0], "repeat"))
{
// get current playlist
int iPlaylist = CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist();
PLAYLIST::REPEAT_STATE previous_state = CServiceBroker::GetPlaylistPlayer().GetRepeat(iPlaylist);
std::string paramlow(params[0]);
StringUtils::ToLower(paramlow);
PLAYLIST::REPEAT_STATE state;
if (paramlow == "repeatall")
state = PLAYLIST::REPEAT_ALL;
else if (paramlow == "repeatone")
state = PLAYLIST::REPEAT_ONE;
else if (paramlow == "repeatoff")
state = PLAYLIST::REPEAT_NONE;
else if (previous_state == PLAYLIST::REPEAT_NONE)
state = PLAYLIST::REPEAT_ALL;
else if (previous_state == PLAYLIST::REPEAT_ALL)
state = PLAYLIST::REPEAT_ONE;
else
state = PLAYLIST::REPEAT_NONE;
if (state == previous_state)
return 0;
// check to see if we should notify the user
bool notify = (params.size() == 2 && StringUtils::EqualsNoCase(params[1], "notify"));
CServiceBroker::GetPlaylistPlayer().SetRepeat(iPlaylist, state, notify);
// save settings for now playing windows
switch (iPlaylist)
{
case PLAYLIST_MUSIC:
CMediaSettings::GetInstance().SetMusicPlaylistRepeat(state == PLAYLIST::REPEAT_ALL);
CServiceBroker::GetSettingsComponent()->GetSettings()->Save();
break;
case PLAYLIST_VIDEO:
CMediaSettings::GetInstance().SetVideoPlaylistRepeat(state == PLAYLIST::REPEAT_ALL);
CServiceBroker::GetSettingsComponent()->GetSettings()->Save();
}
// send messages so now playing window can get updated
CGUIMessage msg(GUI_MSG_PLAYLISTPLAYER_REPEAT, 0, 0, iPlaylist, (int)state);
CServiceBroker::GetGUI()->GetWindowManager().SendThreadMessage(msg);
}
else if (StringUtils::StartsWithNoCase(params[0], "resumelivetv"))
{
CFileItem& fileItem(g_application.CurrentFileItem());
PVR::CPVRChannelPtr channel = fileItem.HasPVRRecordingInfoTag() ? fileItem.GetPVRRecordingInfoTag()->Channel() : PVR::CPVRChannelPtr();
if (channel)
{
CFileItem playItem(channel);
if (!g_application.PlayMedia(playItem, "", channel->IsRadio() ? PLAYLIST_MUSIC : PLAYLIST_VIDEO))
{
CLog::Log(LOGERROR, "ResumeLiveTv could not play channel: %s", channel->ChannelName().c_str());
return false;
}
}
}
else if (paramlow == "reset")
{
g_application.OnAction(CAction(ACTION_PLAYER_RESET));
}
return 0;
}
/*! \brief Play currently inserted DVD.
* \param params The parameters.
* \details params[0] = "restart" to restart from resume point (optional).
*/
static int PlayDVD(const std::vector<std::string>& params)
{
#ifdef HAS_DVD_DRIVE
bool restart = false;
if (!params.empty() && StringUtils::EqualsNoCase(params[0], "restart"))
restart = true;
MEDIA_DETECT::CAutorun::PlayDisc(g_mediaManager.GetDiscPath(), true, restart);
#endif
return 0;
}
/*! \brief Start playback of media.
* \param params The parameters.
* \details params[0] = URL to media to play (optional).
* params[1,...] = "isdir" if media is a directory (optional).
* params[1,...] = "1" to start playback in fullscreen (optional).
* params[1,...] = "resume" to force resuming (optional).
* params[1,...] = "noresume" to force not resuming (optional).
* params[1,...] = "playoffset=<offset>" to start playback from a given position in a playlist (optional).
*/
static int PlayMedia(const std::vector<std::string>& params)
{
CFileItem item(params[0], false);
if (URIUtils::HasSlashAtEnd(params[0]))
item.m_bIsFolder = true;
// restore to previous window if needed
if( CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow() == WINDOW_SLIDESHOW ||
CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO ||
CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow() == WINDOW_FULLSCREEN_GAME ||
CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow() == WINDOW_VISUALISATION )
CServiceBroker::GetGUI()->GetWindowManager().PreviousWindow();
// reset screensaver
g_application.ResetScreenSaver();
g_application.WakeUpScreenSaverAndDPMS();
// ask if we need to check guisettings to resume
bool askToResume = true;
int playOffset = 0;
for (unsigned int i = 1 ; i < params.size() ; i++)
{
if (StringUtils::EqualsNoCase(params[i], "isdir"))
item.m_bIsFolder = true;
else if (params[i] == "1") // set fullscreen or windowed
CMediaSettings::GetInstance().SetVideoStartWindowed(true);
else if (StringUtils::EqualsNoCase(params[i], "resume"))
{
// force the item to resume (if applicable) (see CApplication::PlayMedia)
item.m_lStartOffset = STARTOFFSET_RESUME;
askToResume = false;
}
else if (StringUtils::EqualsNoCase(params[i], "noresume"))
{
// force the item to start at the beginning (m_lStartOffset is initialized to 0)
askToResume = false;
}
else if (StringUtils::StartsWithNoCase(params[i], "playoffset=")) {
playOffset = atoi(params[i].substr(11).c_str()) - 1;
item.SetProperty("playlist_starting_track", playOffset);
}
}
if (!item.m_bIsFolder && item.IsPlugin())
item.SetProperty("IsPlayable", true);
if ( askToResume == true )
{
if ( CGUIWindowVideoBase::ShowResumeMenu(item) == false )
return false;
}
if (item.m_bIsFolder)
{
CFileItemList items;
std::string extensions = CServiceBroker::GetFileExtensionProvider().GetVideoExtensions() + "|" + CServiceBroker::GetFileExtensionProvider().GetMusicExtensions();
XFILE::CDirectory::GetDirectory(item.GetPath(), items, extensions, XFILE::DIR_FLAG_DEFAULTS);
if (!items.IsEmpty()) // fall through on non expandable playlist
{
bool containsMusic = false, containsVideo = false;
for (int i = 0; i < items.Size(); i++)
{
bool isVideo = items[i]->IsVideo();
containsMusic |= !isVideo;
containsVideo |= isVideo;
if (containsMusic && containsVideo)
break;
}
std::unique_ptr<CGUIViewState> state(CGUIViewState::GetViewState(containsVideo ? WINDOW_VIDEO_NAV : WINDOW_MUSIC_NAV, items));
if (state.get())
items.Sort(state->GetSortMethod());
else
items.Sort(SortByLabel, SortOrderAscending);
int playlist = containsVideo? PLAYLIST_VIDEO : PLAYLIST_MUSIC;;
if (containsMusic && containsVideo) //mixed content found in the folder
{
for (int i = items.Size() - 1; i >= 0; i--) //remove music entries
{
if (!items[i]->IsVideo())
items.Remove(i);
}
}
CServiceBroker::GetPlaylistPlayer().ClearPlaylist(playlist);
CServiceBroker::GetPlaylistPlayer().Add(playlist, items);
CServiceBroker::GetPlaylistPlayer().SetCurrentPlaylist(playlist);
CServiceBroker::GetPlaylistPlayer().Play(playOffset, "");
return 0;
}
}
if ((item.IsAudio() || item.IsVideo()) && !item.IsPlayList() && !item.IsSmartPlayList())
CServiceBroker::GetPlaylistPlayer().Play(std::make_shared<CFileItem>(item), "");
else
g_application.PlayMedia(item, "", PLAYLIST_NONE);
return 0;
}
/*! \brief Start playback with a given playback core.
* \param params The parameters.
* \details params[0] = Name of playback core.
*/
static int PlayWith(const std::vector<std::string>& params)
{
g_application.OnAction(CAction(ACTION_PLAYER_PLAY, params[0]));
return 0;
}
/*! \brief Seek in currently playing media.
* \param params The parameters.
* \details params[0] = Number of seconds to seek.
*/
static int Seek(const std::vector<std::string>& params)
{
if (g_application.GetAppPlayer().IsPlaying())
g_application.GetAppPlayer().GetSeekHandler().SeekSeconds(atoi(params[0].c_str()));
return 0;
}
// Note: For new Texts with comma add a "\" before!!! Is used for table text.
//
/// \page page_List_of_built_in_functions
/// \section built_in_functions_12 Player built-in's
///
/// -----------------------------------------------------------------------------
///
/// \table_start
/// \table_h2_l{
/// Function,
/// Description }
/// \table_row2_l{
/// <b>`PlaysDisc(parm)`</b>\n
/// <b>`PlayDVD(param)`</b>(deprecated)
/// ,
/// Plays the inserted disc\, like CD\, DVD or Blu-ray\, in the disc drive.
/// @param[in] param "restart" to restart from resume point (optional)
/// }
/// \table_row2_l{
/// <b>`PlayerControl(control[\,param])`</b>
/// ,
/// Allows control of music and videos. <br>
/// <br>
/// | Control | Video playback behaviour | Audio playback behaviour | Added in |
/// |:------------------------|:---------------------------------------|:----------------------------|:------------|
/// | Play | Play/Pause | Play/Pause | |
/// | Stop | Stop | Stop | |
/// | Forward | Fast Forward | Fast Forward | |
/// | Rewind | Rewind | Rewind | |
/// | Next | Next chapter or movie in playlists | Next track | |
/// | Previous | Previous chapter or movie in playlists | Previous track | |
/// | TempoUp | Increases playback speed | none | Kodi v18 |
/// | TempoDown | Decreases playback speed | none | Kodi v18 |
/// | BigSkipForward | Big Skip Forward | Big Skip Forward | Kodi v15 |
/// | BigSkipBackward | Big Skip Backward | Big Skip Backward | Kodi v15 |
/// | SmallSkipForward | Small Skip Forward | Small Skip Forward | Kodi v15 |
/// | SmallSkipBackward | Small Skip Backward | Small Skip Backward | Kodi v15 |
/// | SeekPercentage(n) | Seeks to given percentage | Seeks to given percentage | |
/// | Random * | Toggle Random Playback | Toggle Random Playback | |
/// | RandomOn | Sets 'Random' to 'on' | Sets 'Random' to 'on' | |
/// | RandomOff | Sets 'Random' to 'off' | Sets 'Random' to 'off' | |
/// | Repeat * | Cycles through repeat modes | Cycles through repeat modes | |
/// | RepeatOne | Repeats a single video | Repeats a single track | |
/// | RepeatAll | Repeat all videos in a list | Repeats all tracks in a list| |
/// | RepeatOff | Sets 'Repeat' to 'off' | Sets 'Repeat' to 'off' | |
/// | Partymode(music) ** | none | Toggles music partymode | |
/// | Partymode(video) ** | Toggles video partymode | none | |
/// | Partymode(path to .xsp) | Partymode for *.xsp-file | Partymode for *.xsp-file | |
/// | ShowVideoMenu | Shows the DVD/BR menu if available | none | |
/// | FrameAdvance(n) *** | Advance video by _n_ frames | none | Kodi v18 |
/// <br>
/// '*' = For these controls\, the PlayerControl built-in function can make use of the 'notify'-parameter. For example: PlayerControl(random\, notify)
/// <br>
/// '**' = If no argument is given for 'partymode'\, the control will default to music.
/// <br>
/// '***' = This only works if the player is paused.
/// <br>
/// @param[in] control Control to execute.
/// @param[in] param "notify" to notify user (optional\, certain controls).
///
/// @note 'TempoUp' or 'TempoDown' only works if "Sync playback to display" is enabled.
/// @note 'Next' will behave differently while using video playlists. In those\, chapters will be ignored and the next movie will be played.
/// }
/// \table_row2_l{
/// <b>`Playlist.Clear`</b>
/// ,
/// Clear the current playlist
/// @param[in] (ignored)
/// }
/// \table_row2_l{
/// <b>`Playlist.PlayOffset(positionType[\,position])`</b>
/// ,
/// Start playing from a particular offset in the playlist
/// @param[in] positionType Position in playlist or playlist type.
/// @param[in] position Position in playlist if params[0] is playlist type (optional).
/// }
/// \table_row2_l{
/// <b>`PlayMedia(media[\,isdir][\,1]\,[playoffset=xx])`</b>
/// ,
/// Plays the media. This can be a playlist\, music\, or video file\, directory\,
/// plugin or an Url. The optional parameter "\,isdir" can be used for playing
/// a directory. "\,1" will start a video in a preview window\, instead of
/// fullscreen. If media is a playlist\, you can use playoffset=xx where xx is
/// the position to start playback from.
/// @param[in] media URL to media to play (optional).
/// @param[in] isdir Set "isdir" if media is a directory (optional).
/// @param[in] fullscreen Set "1" to start playback in fullscreen (optional).
/// @param[in] resume Set "resume" to force resuming (optional).
/// @param[in] noresume Set "noresume" to force not resuming (optional).
/// @param[in] playeroffset Set "playoffset=<offset>" to start playback from a given position in a playlist (optional).
/// }
/// \table_row2_l{
/// <b>`PlayWith(core)`</b>
/// ,
/// Play the selected item with the specified player core.
/// @param[in] core Name of playback core.
/// }
/// \table_row2_l{
/// <b>`Seek(seconds)`</b>
/// ,
/// Seeks to the specified relative amount of seconds within the current
/// playing media. A negative value will seek backward and a positive value forward.
/// @param[in] seconds Number of seconds to seek.
/// }
/// \table_end
///
CBuiltins::CommandMap CPlayerBuiltins::GetOperations() const
{
return {
{"playdisc", {"Plays the inserted disc, like CD, DVD or Blu-ray, in the disc drive.", 0, PlayDVD}},
{"playdvd", {"Plays the inserted disc, like CD, DVD or Blu-ray, in the disc drive.", 0, PlayDVD}},
{"playlist.clear", {"Clear the current playlist", 0, ClearPlaylist}},
{"playlist.playoffset", {"Start playing from a particular offset in the playlist", 1, PlayOffset}},
{"playercontrol", {"Control the music or video player", 1, PlayerControl}},
{"playmedia", {"Play the specified media file (or playlist)", 1, PlayMedia}},
{"playwith", {"Play the selected item with the specified core", 1, PlayWith}},
{"seek", {"Performs a seek in seconds on the current playing media file", 1, Seek}}
};
}