音频播放器的离子 [英] Audio Player for ionic

查看:147
本文介绍了音频播放器的离子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我学习离子和希望嵌入音频播放器。我已经找到了视频播放器这Plnkr例如:

I am learning ionic and want to embed an Audio Player. I have found this Plnkr example of Video Player:

    angular.module('app',[])

.directive('youtubeIframe', ['$timeout', function ($timeout, $sce ) {
    return {
        restrict: 'A',
        link: function (scope, element, attrs) {
            $timeout( function () {
                var temp1 = '<iframe width="400px" height="200px" src="http://www.youtube.com/embed/';
                var temp2 = '?&autoplay=0&autohide=1&fs=1&cc_load_policy=1&loop=0&rel=0&modestbranding=1&&hd=1&playsinline=0&showinfo=0&theme=light" frameborder="1" allowfullscreen></iframe>';
                var finalvar = temp1 + attrs.youtubeIframe + temp2 ;
                console.log('Finalvar is: ' + finalvar); //just to check if url is ok
                element.prepend( finalvar );
            }, 150);
            // The timeout is to give enough time for the Dom to be built and checked for its structure, so that we can manipulate it.
        }
    };
}])



.controller('VideoCtrl', function($scope) {

    $scope.angularvideos = [
      { 
        name: 'Angular on the go: Using Angular to power Mobile Apps', 
        youtubeId: 'xOAG7Ab_Oz0',
        publishdate: 'Dec 2013'
      },
      { 
        name: 'Crafting the Perfect AngularJS Model and Making it Real Time', 
        youtubeId: 'lHbWRFpbma4',
        publishdate: 'April 2014'
      },
      { 
        name: 'AngularJS & D3: Directives for Visualizations', 
        youtubeId: 'aqHBLS_6gF8',
        publishdate: 'Jan 2014'
      },
      { 
        name: 'The Thick Front End', 
        youtubeId: 'hv2NEW0uC1o',
        publishdate: 'Nov 2013'
      }
    ];
})

可有人请点我的音频播放器一个类似的例子IFRAME的移动应用(Android暂时,但后来在iOS以及)。在

Can someone please point me to a similar example for Audio Player within iframe for a mobile App (Android for the time being, but later on iOS as well).

感谢和放大器;问候

推荐答案

我发布使用科尔多瓦媒体插件播放音频本身(测试它在Android到目前为止)一个离子模块。

I released a Ionic module that plays audio natively (tested it on Android so far) using the Cordova Media plugin.

您定义离子的看法:

<ion-view view-title="Music">
  <ion-content>
      <ion-audio-track track="myTrack">
          <div class="list list-inset">
              <div class="item item-thumbnail-left">
                  <img src="{{track.art}}">
                  <h2>{{track.title}}</h2>
                  <p>{{track.artist}}</p>
                  <ion-audio-play></ion-audio-play>
              </div>
              <div class="item">
                <ion-audio-progress-bar display-time></ion-audio-progress-bar>
              </div>
          </div>
      </ion-audio-track>
  </ion-content>
</ion-view>

和你的范围:

$scope.myTrack = {
    url: 'https://www.example.com/my_song.mp3',
    artist: 'Somebody',
    title: 'Song name',
    art: 'img/album_art.jpg'
}

是这样的:

您可以在这里找到: https://github.com/arielfaur/ionic-audio

这篇关于音频播放器的离子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆