Skip to content

Instantly share code, notes, and snippets.

.controller('StreamController', function() {
var isPlaying = false;
var stream;
var vm = angular.extend(this, {
togglePlay: togglePlay,
isPlaying: isPlaying
});
// ********************************************************************
.factory('streamService', function($http, $q){
var streamUrl = 'http://198.100.125.242:80/';
var metadataUrl = streamUrl + '7.html';
var contentRegex = /<body>(.*)<\/body>/;
var itunesSearchUrl = 'https://itunes.apple.com/search?term=';
var resolutionRegex = /100x100/;
var service = {
getStreamInfo: getStreamInfo
.controller('StreamController', function($interval, streamService) {
var isPlaying = false;
var stream;
var timer;
var vm = angular.extend(this, {
togglePlay: togglePlay,
isPlaying: isPlaying,
info: null
});
<ion-view view-title="Movies">
<ion-content>
<div ng-repeat="movie in movies">
<div class="card">
<div class="item item-text-wrap item-thumbnail-left">
<img ng-src="{{movie.thumb}}">
<h2>{{movie.title}}</h2>
<p>{{movie.body}}</p>
</div>
</div>
(function() {
'use strict';
angular
.module('supermodular.movies', [
'ionic'
])
.config(function($stateProvider) {
$stateProvider
.state('app.movies', {
(function() {
'use strict';
angular
.module('supermodular.movies')
.controller('MoviesController', MoviesController);
MoviesController.$inject = ['moviesService', '$http', '$scope'];
/* @ngInject */
(function() {
'use strict';
angular
.module('supermodular.movies')
.factory('moviesService', moviesService);
moviesService.$inject = [];
function moviesService() {
/*
* Stream
*/
.stream-background {
background: url('http://lorempixel.com/1024/768/') center center;
background-size: cover;
}
.play-button-icon.icon:before {
<ion-view view-title="Live radio">
<ion-content class="stream-background center">
<a class="button button-icon icon play-button-icon {{ vm.isPlaying ? 'ion-ios-pause' : 'ion-ios-play' }}"
ng-click="vm.togglePlay()"></a>
</ion-content>
</ion-view>
function play() {
// Display loader
if (window.Stream) {
stream = new window.Stream(audioStream);
// Play audio
stream.play();
}
// Hide loader after XXX sec
getStreamInfo();