getmusicbee.com
Support => Developers' Area => MusicBee API => Topic started by: lamrongol on March 16, 2014, 04:04:28 PM
-
Hi.
I am now developing a plugin to play music and music videos continuously in playlist. (play video by vlc with play-and-exit option, and play next track when video play is finished)
https://github.com/lamrongol/MusicBeeVlcVideoPlayPlugin
However, this plugin can't work if a user plays specified video because video play notification doesn't exist(TrackChanged, TrackChanging doesn't work when playing video) and can't stop launching default video player.
Would you add such notification?
-
i am happy to enhance the API but i need to better understand what you are doing.
When a user plays a video file in MB, it will launch the configured video player such as WMP, VLC etc.
When you plugin is enabled i guess you want MB to not launch the video player but rather notify your plugin in some way?
Can i ask what your plugin will do to add value to this? (I only ask to better understand to better provide you with what you need)
-
Sorry for unclear description
When you plugin is enabled i guess you want MB to not launch the video player but rather notify your plugin in some way?
Can i ask what your plugin will do to add value to this? (I only ask to better understand to better provide you with what you need)
On default behavior, MB doesn't play video even if a playlist contains video file. And MB doesn't play next track after launching a video player.
This plugin plays video files when a user plays a playlist including video files and play next track when video play is finished.
These features are possible in current version when a user plays a playlist, however, a plugin can't detect and play a video file when a user plays a specified video file, not playlist.
So I need two features.
-disable default behavior, launching video player
-detect a video file a user intend to play
-
http://musicbee.niblseed.com/V2_4/MusicBee_Exe_Patched.zip
and the updated interface file definition:
http://www.mediafire.com/download/zq6mr986wqa9rp6/MusicBeeInterface.zip
change MinApiRevision to 39 in the MusicBeeInterface file to force users to MB v2.4 to use the plugin
in the Plugin class Initialise() function:
about.Type = PluginType.VideoPlayer;
and create a function as follows:
public bool PlayVideo(string[] urls)
{
...your code
return true;
}
When MB detects that function in a plugin it will call it instead of invoking an external .exe
Although urls is an array i think with the current MB version it only ever passes one value in the array but i am not completely sure about that
If you are planning to embed the video player inside MB and want to draw it on a panel:
videoPanel = New Panel
videoPanel.Bounds = mbApiInterface.MB_GetPanelBounds(PluginPanelDock.ApplicationWindow)
mbApiInterface.MB_AddPanel(videoPanel, PluginPanelDock.ApplicationWindow)
...
mbApiInterface.MB_RemovePanel(videoPanel)
MB will resize the panel automatically
-
Thank you very much for adding features.
But, I want to apologize for having to ask a favor of you again, could I ask two more features?
1. I noticed that MB plays video files in playlist when shuffle mode is off and MB doesn't play when shuffle mode is on.
Could you make MB play video files when shuffle mode is on, too?
2. Could you make MB show current playing video file on bottom panel so that a user can operate(e.g. giving star. I 'm going to add a feature to edit tag by taglib-sharp in the future)
-
for 1, by default when a video file is added to the library the "skip when shuffling" flag is set. You can adjust that using the tag editor and i have changed it so it no longer does that for new files added to the video library
for 2, that is done now:
http://musicbee.niblseed.com/V2_4/MusicBee_Exe_Patched.zip
Also i can confirm you will only ever get 1 file in the array for your PlayVideo function
-
Thank you! I'll struggle to relase this plugin soon.
Update:
Released
Video Continuous Play plugin (Require MusicBee 2.4 or later) - MusicBee - Forum
http://getmusicbee.com/forum/index.php?topic=12419
-
When video play starts, play state changes to "Stopped".
If it is not difficult, could you make it not changed?
-
i will make a change to accomodate this probably in the next couple of days
-
actually do you really need this? - wouldnt it make more sense to control the playback from VLC. I will do this if you still think its important
-
I want to implement a feature to stop playing video when a user clicks stop button. as following topic.
Video Continuous Play plugin (Require MusicBee 2.4 or later) - MusicBee - Forum
http://getmusicbee.com/forum/index.php?topic=12419
But on latest version, "PlayStateChanged" notification doesn't occur when stop button is clicked.
-
it might be a week or two before i can look at this
-
Could you tell me whether you will implement or not this feature?
-
sorry - i forgot about this. I am now in the middle of another change so i wont be until next weekend i can look at it
-
i have had a look at this but perhaps i dont understand exactly what you want.
When i click the Stop button in musicbee a notification is sent to plugins "PlayStateChanged"
your plugin should receive that notification asynchronously ie. it might be a few milliseconds after the user has clicked stop.
You can then query the playstate via the musicbee api Player_GetPlayState() which should return a status of Stopped
But i expect you know all of this so have i misunderstood your requirement?
-
>When i click the Stop button in musicbee a notification is sent to plugins "PlayStateChanged"
Yes if when playing music. But when MB start playing a video, PlayState change to "Stopped" and PlayState doesn't change when clicking the Stop button or playing another video(when playing other music file, PlayState change "Playing"
I confirmed by below code.
case NotificationType.PlayStateChanged:
MessageBox.Show(mbApiInterface.Player_GetPlayState() + "");
break;
-
I can do a simple solution of sending a stop notification when that button is clicked and will make the change for the next update.
But its not really a proper solution in that MusicBee doesnt know the play state of the video unless its controlling all playback actions or your plugin tells MusicBee the play state and MusicBee updates the player buttons (in which case i would need to add some more API calls).
Is the idea with your plugin that MusicBee controls the play state or is it a mixture of both MusicBee and the video player itself?
-
this has the change:
http://musicbee.niblseed.com/V2_4/MusicBee_Exe_Patched.zip
but let me know your comments
-
Hmm...
For me, this newer version is sufficient.
And, it is equivalent for current and newer version on the point that MusicBee doesn't know real state of video playing. So this change doesn't make MB worse, I think.
I think more complicated APIs will be confusing because knowing real state of video playing by external process is difficult(this plugin only knows whether external process is running or not).
-
Your solution works fine with VLC and videos should be played with that specialized application.
Stopping:
Stopping does not work, sometimes gets me two VLC processes. MB does not react on stopping or closing VLC. And stopping in MB does not have impact on VLC.
Tagging:
I have different music videos (mp4/mv4) of concerts with each containing serveral titels/tracks.
I tested around an saw, that mp4-tags are not read by MB.
If I have an similar mp3-file I put an cue sheet aside and can handle these tracks just as if they were single files.
Together with cue sheet files aside an m4v this also works within MB, except that the video always starts at the beginning.
I would appreciate when you add a start time to your interface to VLC, and probably also a play length. I know that VLC can do at least start times.
I know that VLC also writes XSPF-Files with bookmarks, but that is a different story and a less easy editing variant to cue sheets.
-
I can't guarantee for complicated case but newer version of MusicBee and the plugin may work.
See below
http://getmusicbee.com/forum/index.php?topic=12419.msg82235#msg82235
-
@Steven
Sorry for too late response.
On latest version of MusicBee, this api doesn't work correctly.
1.public bool PlayVideo(string[] urls) function isn't called if previous played file is music.
I found following pattern
-Video -> Video: played
-Video -> Music: played
-Music -> Video: isn't played
2.When playing video, "play" button doesn't turn to "stop" button so users can't stop a video.
Would you please repair it when you have time?
Thanks,
-
i will look at this but not for a week or two
-
I found one more problem(not related video api).
Contrary to music, when rating playing video, "プロセスはファイルにアクセスできません。別のプロセスが使用中です"(Process can't access file. Another process is using) message shown and can't edit file.
-
@Steven
Sorry for too late response.
On latest version of MusicBee, this api doesn't work correctly.
1.public bool PlayVideo(string[] urls) function isn't called if previous played file is music.
I found following pattern
-Video -> Video: played
-Video -> Music: played
-Music -> Video: isn't played
2.When playing video, "play" button doesn't turn to "stop" button so users can't stop a video.
Would you please repair it when you have time?
Thanks,
I have spent some time looking at this but i cant see why it would not work or even how its changed from v3.0
I dont think i can spend more time on this so will leave it unsolved.
for 2, i dont think that has ever been the case. Did you mean turn to "pause" ? you can hold the shift key down when pressing the play button to activate stop