Results 1 to 6 of 6

Thread: CE audio-player with playlist..? (Contao 3.5)

  1. #1
    New user perdy's Avatar
    Join Date
    10-29-09.
    Posts
    7

    Default CE audio-player with playlist..? (Contao 3.5)

    Hi Contao-Wizards

    Can anybody help me make a audio-playlist-template (e.g. ce_player_playlist.html5) from the ce_player.html5?
    In these links there are some hints (but I can’t figure out what to do):
    https://github.com/contao/core/issues/8667
    https://community.contao.org/de/show...r-mit-Playlist

    If I use:
    foreach($this->files as $file)
    { dump($file->path); }
    it only gives me the file-path of the first of each format (m4a, mp3 etc,).

    How can I get a complete list of the files selected in CE video/audio..?

    Best Regards - Per

  2. #2
    User Andreas's Avatar
    Join Date
    07-11-09.
    Location
    Mönchengladbach
    Posts
    484

    Default

    Use this code to inspect if there is a variable with all selected files.
    PHP Code:
    <?php $this->showTemplateVars() ?>
    In your linked post fritzmg implies how to get the values of those files which are stored in tl_files https://github.com/contao/core/issue...ment-286345050.
    Web-Development, Freelancer, Burgtech, XHTML, HTML5, CSS, PHP, Javascript, MooTools, MySQL and more
    Amazon wishlist

  3. #3
    New user perdy's Avatar
    Join Date
    10-29-09.
    Posts
    7

    Default

    Thank you for your reply, Andreas!
    In your linked post fritzmg implies how to get the values of those files which are stored in tl_files
    This is exactly here, I don't know what to do with $this->multiSRC and \FilesModel::findByUuid(…)

    I've made a test-site where I use the $this->showTemplateVars() to inspect the variables, and explain what I'm doing, but I still don't know how to get multiSRC to work:
    https://bifagsklaver.dk/test-audio.html
    Last edited by perdy; 10/12/2018 at 10:18.

  4. #4
    User Andreas's Avatar
    Join Date
    07-11-09.
    Location
    Mönchengladbach
    Posts
    484

    Default

    Ok. As you can see the ->multiSRC variable is empty but there is a ->playerSRC variable which contains a serialized array of the file uuids. Try something like this (untested).
    PHP Code:
    <?php
    foreach(deserialize($this->playerSRCtrue) as $key => $uuid
    {
      
    $trackModel = \FilesModel::findByUuid($uuid);
      
    $tracks[$key]['path'] = $trackModel->path;
      
    $tracks[$key]['name'] = $trackModel->name;
      
    $tracks[$key]['meta'] = $trackModel->meta;
    }
    dump($tracks);

    // deserialize() is a Contao function, "true" forces the return value to be an array even if it is empty.
    ?>
    With a Model you can get any value from a data set (here from tl_files). e.g. from tl_user_group you have to use \UserGroupModel::findByPk($primaryKeyVariable). Also take a look into the docs https://docs.contao.org/books/cookbook/de/Models.html (Sorry there is no english translation so far).
    Web-Development, Freelancer, Burgtech, XHTML, HTML5, CSS, PHP, Javascript, MooTools, MySQL and more
    Amazon wishlist

  5. #5
    New user perdy's Avatar
    Join Date
    10-29-09.
    Posts
    7

    Default

    Yes!!!
    deserialize() - da liegt der Hund begraben - as we also say in Denmark :-)
    Your code gave me all the chosen file-paths.

    I will dig into models.
    Thank you so much Andreas, for your time and help!!

    Best Regards - Per

  6. #6
    User Andreas's Avatar
    Join Date
    07-11-09.
    Location
    Mönchengladbach
    Posts
    484

    Default

    Quote Originally Posted by perdy View Post
    - da liegt der Hund begraben - as we also say in Denmark :-)
    LOL. You're welcome.
    Web-Development, Freelancer, Burgtech, XHTML, HTML5, CSS, PHP, Javascript, MooTools, MySQL and more
    Amazon wishlist

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •