CC-1665: Scheduled stream rebroadcasting and recording
-ability to preview webstreams inside of playlists
This commit is contained in:
parent
952f18dc3c
commit
c73328e297
|
@ -173,26 +173,40 @@ class AudiopreviewController extends Zend_Controller_Action
|
|||
$result[] = $this->createElementMap($track);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$result[] = $this->createElementMap($ele);
|
||||
}
|
||||
}
|
||||
$this->_helper->json($result);
|
||||
}
|
||||
|
||||
function createElementMap($track){
|
||||
private function createElementMap($track)
|
||||
{
|
||||
$elementMap = array( 'element_title' => isset($track['track_title'])?$track['track_title']:"",
|
||||
'element_artist' => isset($track['artist_name'])?$track['artist_name']:"",
|
||||
'element_id' => isset($track['id'])?$track['id']:"",
|
||||
'element_position' => isset($track['position'])?$track['position']:"",
|
||||
);
|
||||
$fileExtension = pathinfo($track['path'], PATHINFO_EXTENSION);
|
||||
if (strtolower($fileExtension) === 'mp3') {
|
||||
$elementMap['element_mp3'] = $track['item_id'];
|
||||
} else if (strtolower($fileExtension) === 'ogg') {
|
||||
$elementMap['element_oga'] = $track['item_id'];
|
||||
);
|
||||
|
||||
|
||||
$elementMap['type'] = $track['type'];
|
||||
|
||||
if ($track['type'] == 0) {
|
||||
$fileExtension = pathinfo($track['path'], PATHINFO_EXTENSION);
|
||||
//type is file
|
||||
//TODO: use MIME type for this
|
||||
if (strtolower($fileExtension) === 'mp3') {
|
||||
$elementMap['element_mp3'] = $track['item_id'];
|
||||
} else if (strtolower($fileExtension) === 'ogg') {
|
||||
$elementMap['element_oga'] = $track['item_id'];
|
||||
} else {
|
||||
//the media was neither mp3 or ogg
|
||||
throw new Exception("Unknown file type");
|
||||
}
|
||||
|
||||
$elementMap['uri'] = "/api/get-media/file/".$track['item_id'];
|
||||
} else {
|
||||
//the media was neither mp3 or ogg
|
||||
$elementMap['uri'] = $track['path'];
|
||||
}
|
||||
return $elementMap;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ function playAllPlaylist(p_playlistID, p_playlistIndex) {
|
|||
|
||||
if ( _idToPostionLookUp !== undefined && viewsPlaylistID == p_playlistID ) {
|
||||
play(p_playlistIndex);
|
||||
}else {
|
||||
} else {
|
||||
buildplaylist("/audiopreview/get-playlist/playlistID/"+p_playlistID, p_playlistIndex);
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ function playBlock(p_blockId, p_blockIndex)
|
|||
|
||||
if ( _idToPostionLookUp !== undefined && viewsBlockId == p_blockId ) {
|
||||
play(p_blockIndex);
|
||||
}else {
|
||||
} else {
|
||||
buildplaylist("/audiopreview/get-block/blockId/"+p_blockId, p_blockIndex);
|
||||
}
|
||||
}
|
||||
|
@ -125,19 +125,27 @@ function buildplaylist(p_url, p_playIndex) {
|
|||
var total = 0;
|
||||
for(index in data){
|
||||
|
||||
if (data[index]['element_mp3'] != undefined){
|
||||
media = {title: data[index]['element_title'],
|
||||
if (data[index]['type'] == 0) {
|
||||
if (data[index]['element_mp3'] != undefined){
|
||||
media = {title: data[index]['element_title'],
|
||||
artist: data[index]['element_artist'],
|
||||
mp3:data[index]['uri']
|
||||
};
|
||||
} else if (data[index]['element_oga'] != undefined) {
|
||||
media = {title: data[index]['element_title'],
|
||||
artist: data[index]['element_artist'],
|
||||
oga:data[index]['uri']
|
||||
};
|
||||
}
|
||||
} else if (data[index]['type'] == 1) {
|
||||
media = {title: data[index]['element_title'],
|
||||
artist: data[index]['element_artist'],
|
||||
mp3:"/api/get-media/file/"+data[index]['element_mp3']
|
||||
};
|
||||
}else if (data[index]['element_oga'] != undefined) {
|
||||
media = {title: data[index]['element_title'],
|
||||
artist: data[index]['element_artist'],
|
||||
oga:"/api/get-media/file/"+data[index]['element_oga']
|
||||
mp3:data[index]['uri']
|
||||
};
|
||||
}
|
||||
myPlaylist[index] = media;
|
||||
|
||||
if (media) {
|
||||
myPlaylist[index] = media;
|
||||
}
|
||||
// we should create a map according to the new position in the player itself
|
||||
// total is the index on the player
|
||||
_idToPostionLookUp[data[index]['element_id']] = total;
|
||||
|
|
Loading…
Reference in New Issue