【发布时间】:2015-02-15 06:35:10
【问题描述】:
我正在学习 Ionic,想嵌入一个音频播放器。我找到了Video Player 的这个 Plnkr 示例:
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 上也是如此)中的音频播放器是否有类似的示例?
【问题讨论】:
标签: android angularjs ionic-framework audio