Only 12 days left until RunRevLive.14 kicks off in San Diego. Get Your Ticket >

Multimedia on Mac OS – A quick progress update

Things are running smoothly regarding the update of the player object. In this post I will briefly describe what has been done so far.

The first step was the refactoring of the MCPlayer related code. Formerly, the MCPlayer class used ifdefs in most functions, based on whether it was using the ‘platform player’, ‘quicktime’, or was on Linux. Now, MCPlayer is split into two classes in separate files (player-legacy.cpp/.h and player-platform.cpp/.h). The former is the pre-platform API version; the latter the platform API version. This made it easier to update the platform-player version to use its own controller.

The next step was to implement a custom controller bar. For the reasons described in the previous blog post for Multimedia on Mac OS, we had to implement our own controller. After some discussion, and some research on the appearance of modern video controllers, we are almost there! Below is a preview of the current, and probably final version.

 playerpurple

 

Because some users may not like this color, we thought it is better to make it customisable. So we added some properties to the player object. In fact, we tied in some existing properties that were not used for the player object. For example, the hiliteColor. For the player object, the hiliteColor is the color of the played area, as well as the color of the volume area in the volume popup window. It is also the color of a button background when this button is clicked. So, if you don’t like the purple color that is set by default, all you have to do is add a new button (or just type in the message box) with the following code:

on mouseUp

set the hiliteColor of player to re

end mouseUp 

The result is the following:

 playerred 

In the player object, you can also set the foreColor, which is the color of the selected area, i.e. the color of the area between the selection handles. This is dark grey by default.

 player3

 

Modify the code in your button, to change both the hiliteColor and the foreColor

on mouseUp

set the hiliteColor of player 1 to127,255,0″

set the foreColor of player to “106,156,56″

end mouseUp

The result is the following:

player4 

Finally, we had to move from Quicktime/QTKit to AVFoundation. This transition is now done, and the new player object seems to work perfectly with the AVFoundation APIs. Some tweaks have still to be done, in order to ensure similar (or at least as similar as possible) behaviour with the old Quicktime/QTKit controller. Next, and final step as far as the player object is concerned, is to test it thoroughly and fix any bugs that may arise.



Discussion

  1. Dougy

    Good stuff, Pana. I may have missed something, but are we ever going to see multiple, simultaneous audio channels (with cached audio files for instant playback) addressed on OSX as it is on iOS?


  2. Devin Asay

    As long as you are adding properties to the player object, how about letting us set the playIcon, the volumeIcon, the reverseIcon, etc., along with hilite, hover, and disabled versions of all of them.
    That would be a huge boon for skinning and theming!


  3. Klaus Major

    Very cool, but we might have to talk abou the default color…

    Short question:
    QT 7 had this great feature to change speed and pitch of a movie independently from each other. Does AVKit also support this extremely handy (not only for musicians like me) feature?

    Thank you!


    1. Panagiotis Merakos

      Hi Klaus,
      Well, as far as I know AVFoundation does not support this feature. It has facilities for setting the time pitch algorithms, where one can choose from 3 available choices, balancing between quality and computational cost. But this feature is available in OSX v10.9 and later. With the new player, you will be able to change the movie rate (as this was the case with the old one). However, in the future we can take a look and see what is possible. Thanks for the feature request


  4. BvG

    Those default colours adhere to no HIG rulebook, and are extremely arbitrary. I also think they’re ugly (violet) and too hard to see (dark grey).

    Why not use the platform defaults instead? Those exist for a reason!


    1. Ben

      Hi BvG,

      Thanks for your comment. The player colour properties allow you to choose whatever colour your like for your UI. If you would like to conform to the platform HIG rules you can do so. Especially if Panos’ choice of colour isn’t to your liking. These screenshots are taken with a slightly older prototype, the appearance of the bar has progressed since so you’ll be able to try it for yourself when the next release of LiveCode 6.7 comes out.

      Warm regards,

      Ben


  5. malte

    The inevitable question: What about the other (desktop) platforms? Besides that, I really like the use of the properties.


    1. ben

      Hi Malte,

      LiveCode 6.7 will features the media replacement on Mac. We’ll then start looking at the other platforms.

      Warm regards,

      Ben


  6. Sean Cole

    Eager anticipation. Thanks for the update Panagiotis


Comment