* fix iphone/ipad actions, also stop doing popups anywhere
This commit is contained in:
parent
73a04d4d95
commit
fbc2e9498f
|
|
@ -32,6 +32,8 @@ module JamRuby
|
|||
|
||||
def self.check(user, remote_ip, target, owned)
|
||||
|
||||
return unless APP_CONFIG.guard_against_browser_fraud
|
||||
|
||||
create(user, remote_ip, target, owned)
|
||||
|
||||
# let's check the following
|
||||
|
|
|
|||
|
|
@ -246,6 +246,10 @@ def app_config
|
|||
30
|
||||
end
|
||||
|
||||
def guard_against_browser_fraud
|
||||
true
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def audiomixer_workspace_path
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@
|
|||
}
|
||||
|
||||
if (options.mediaActions) {
|
||||
options.mediaActions.mediaStartPlay({playbackMode: playbackMode, playbackMonitorMode: playbackMonitorMode})
|
||||
options.mediaActions.mediaStartPlay.trigger({playbackMode: playbackMode, playbackMonitorMode: playbackMonitorMode})
|
||||
}
|
||||
else {
|
||||
$self.triggerHandler('play', {playbackMode: playbackMode, playbackMonitorMode: playbackMonitorMode});
|
||||
|
|
|
|||
|
|
@ -16,6 +16,11 @@ if window.opener?
|
|||
|
||||
# temporarily..
|
||||
# reactContext = window
|
||||
if true
|
||||
# if /iPhone|iPad|iPod/i.test(navigator.userAgent)
|
||||
# iPad or iPhone
|
||||
reactContext = window
|
||||
|
||||
|
||||
MediaPlaybackActions = reactContext.MediaPlaybackActions
|
||||
BrowserMediaStore = reactContext.BrowserMediaStore
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ rest = context.JK.Rest()
|
|||
playJamTracks = []
|
||||
|
||||
for jamTrack in @state.purchasedJamTracks
|
||||
playJamTracks.push `<tr className="play-jamtrack"><td><a onClick={this.onPlayJamTrack.bind(this, jamTrack)}>{jamTrack.name}</a> by {jamTrack.original_artist}</td></tr>`
|
||||
playJamTracks.push `<tr className="play-jamtrack"><td>
|
||||
<a href={JamTrackPlayerStore.createPopupUrl(jamTrack)} target="_blank" onClick={this.onPlayJamTrack.bind(this, jamTrack)}>{jamTrack.name}</a> by {jamTrack.original_artist}</td></tr>`
|
||||
|
||||
if @state.purchasedJamTracks.length < 5
|
||||
# fill out the table with empty rows
|
||||
|
|
@ -240,9 +241,9 @@ rest = context.JK.Rest()
|
|||
context.JK.popExternalLink($(e.target).attr('href'))
|
||||
|
||||
onPlayJamTrack: (jamTrack, e) ->
|
||||
e.preventDefault()
|
||||
|
||||
if context.jamClient.IsNativeClient()
|
||||
e.preventDefault()
|
||||
tracks = context.JK.TrackHelpers.getUserTracks(context.jamClient)
|
||||
data = {}
|
||||
data.client_id = @app.clientId
|
||||
|
|
@ -291,8 +292,15 @@ rest = context.JK.Rest()
|
|||
@app.notifyServerError jqXHR, 'Unable to Create Session'
|
||||
|
||||
else
|
||||
# popup window
|
||||
JamTrackPlayerActions.open(jamTrack)
|
||||
if true # /iPhone|iPad|iPod|android/i.test(navigator.userAgent)
|
||||
# popup window
|
||||
JamTrackPlayerActions.opened(jamTrack)
|
||||
|
||||
else
|
||||
# popup window
|
||||
JamTrackPlayerActions.open(jamTrack)
|
||||
e.preventDefault()
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ rest = context.JK.Rest()
|
|||
mixins = []
|
||||
|
||||
|
||||
|
||||
# make sure this is actually us opening the window, not someone else (by checking for MixerStore)
|
||||
# this check ensures we attempt to listen if this component is created in a popup
|
||||
reactContext = if window.opener? then window.opener else window
|
||||
|
|
@ -16,8 +17,9 @@ if window.opener?
|
|||
catch e
|
||||
reactContext = window
|
||||
|
||||
# temporarily..
|
||||
# reactContext = window
|
||||
if true # /iPhone|iPad|iPod|android/i.test(navigator.userAgent)
|
||||
# iPad or iPhone
|
||||
reactContext = window
|
||||
|
||||
AppActions = reactContext.AppActions
|
||||
JamTrackPlayerActions = reactContext.JamTrackPlayerActions
|
||||
|
|
@ -143,7 +145,7 @@ mixins.push(Reflux.listenTo(JamTrackPlayerStore, 'onJamTrackPlayerStoreChanged')
|
|||
</div>
|
||||
<div className="mixdown-actions">
|
||||
<img src="/assets/content/icon_open@2X.png" className="mixdown-play" onClick={boundPlayClick}/>
|
||||
<img src="/assets/content/icon_download@2X.png" className="mixdown-download" onClick={boundDownloadClick}/>
|
||||
<a href={this.createJamTrackUrl(jamTrack)} target="_blank" onClick={boundDownloadClick}><img src="/assets/content/icon_download@2X.png" className="mixdown-download"/></a>
|
||||
<img src ="/assets/content/icon-delete@2X.png" style={{visibility:'hidden'}} className="mixdown-edit" onClick={false} />
|
||||
<img src ="/assets/content/icon-delete@2X.png" style={{visibility:'hidden'}} className="mixdown-delete" onClick={false} />
|
||||
</div>
|
||||
|
|
@ -199,7 +201,7 @@ mixins.push(Reflux.listenTo(JamTrackPlayerStore, 'onJamTrackPlayerStoreChanged')
|
|||
if !editIcon
|
||||
editIcon = `<img src ="/assets/content/icon-delete@2X.png" style={{visibility:'hidden'}} className="mixdown-edit" onClick={false} />`
|
||||
|
||||
download = `<img src="/assets/content/icon_download@2X.png" className="mixdown-download" onClick={boundDownloadReadyClick} />`
|
||||
download = `<a onClick={boundDownloadReadyClick} href={this.downloadMixdownUrl(mixdown)} target="_blank"><img src="/assets/content/icon_download@2X.png" className="mixdown-download" /></a>`
|
||||
|
||||
myMixdowns.push `
|
||||
<div key={mixdown.id} className={classNames({'mixdown-display': true, 'active' : active})}>
|
||||
|
|
@ -234,6 +236,7 @@ mixins.push(Reflux.listenTo(JamTrackPlayerStore, 'onJamTrackPlayerStoreChanged')
|
|||
boundStemPlayClick = this.downloadStem.bind(this)
|
||||
boundStemChange = this.stemChanged.bind(this)
|
||||
|
||||
console.log("jamTrack.lastStemId", jamTrack.last_stem_id)
|
||||
myMixdowns.push `
|
||||
<div key={track.id} className={classNames({'stem-track' : true, 'mixdown-display': true, 'active' : active})}>
|
||||
<div className="mixdown-name">
|
||||
|
|
@ -244,7 +247,7 @@ mixins.push(Reflux.listenTo(JamTrackPlayerStore, 'onJamTrackPlayerStoreChanged')
|
|||
</div>
|
||||
<div className="mixdown-actions">
|
||||
<img src="/assets/content/icon_open@2X.png" className="mixdown-play" onClick={boundStemActivateClick}/>
|
||||
<img src="/assets/content/icon_download@2X.png" className="mixdown-download" onClick={boundStemPlayClick} />
|
||||
<a href={this.createStemUrl(jamTrack.id, jamTrack.last_stem_id)} target="_blank" onClick={boundStemPlayClick}><img src="/assets/content/icon_download@2X.png" className="mixdown-download" /></a>
|
||||
<img src ="/assets/content/icon-delete@2X.png" style={{visibility:'hidden'}} className="mixdown-edit" onClick={false} />
|
||||
<img src ="/assets/content/icon-delete@2X.png" style={{visibility:'hidden'}} className="mixdown-delete" onClick={false} />
|
||||
</div>
|
||||
|
|
@ -373,14 +376,14 @@ mixins.push(Reflux.listenTo(JamTrackPlayerStore, 'onJamTrackPlayerStoreChanged')
|
|||
|
||||
|
||||
if @state.showMyMixes
|
||||
showMyMixesText = `<a onClick={this.toggleMyMixes}>hide my mixes <div className="details-arrow arrow-up" /></a>`
|
||||
showMyMixesText = `<a className="show-hide-my-mixes" onClick={this.toggleMyMixes}>hide my mixes <div className="details-arrow arrow-up" /></a>`
|
||||
else
|
||||
showMyMixesText = `<a onClick={this.toggleMyMixes}>show my mixes <div className="details-arrow arrow-down" /></a>`
|
||||
showMyMixesText = `<a className="show-hide-my-mixes" onClick={this.toggleMyMixes}>show my mixes <div className="details-arrow arrow-down" /></a>`
|
||||
|
||||
if @state.showCustomMixes
|
||||
showMixControlsText = `<a onClick={this.toggleCustomMixes}>hide mix controls <div className="details-arrow arrow-up" /></a>`
|
||||
showMixControlsText = `<a className="show-hide-mix-controls" onClick={this.toggleCustomMixes}>hide mix controls <div className="details-arrow arrow-up" /></a>`
|
||||
else
|
||||
showMixControlsText = `<a onClick={this.toggleCustomMixes}>show mix controls <div className="details-arrow arrow-down" /></a>`
|
||||
showMixControlsText = `<a className="show-hide-mix-controls" onClick={this.toggleCustomMixes}>show mix controls <div className="details-arrow arrow-down" /></a>`
|
||||
|
||||
extraControls = `
|
||||
<div className="extra-controls">
|
||||
|
|
@ -397,7 +400,7 @@ mixins.push(Reflux.listenTo(JamTrackPlayerStore, 'onJamTrackPlayerStoreChanged')
|
|||
|
||||
|
||||
if helpLink?
|
||||
helpButton = `<a className="help-link button-grey" href={helpLink} onClick={this.help}>HELP</a>`
|
||||
helpButton = `<a className="help-link button-grey" href={helpLink} target="_blank">HELP</a>`
|
||||
|
||||
`<div className="media-controls-popup">
|
||||
{header}
|
||||
|
|
@ -405,10 +408,10 @@ mixins.push(Reflux.listenTo(JamTrackPlayerStore, 'onJamTrackPlayerStoreChanged')
|
|||
{extraControls}
|
||||
<div className="actions">
|
||||
{helpButton}
|
||||
<a className="close-link button-orange" onClick={this.close}>{closeLinkText}</a>
|
||||
</div>
|
||||
</div>`
|
||||
|
||||
# <a className="close-link button-orange" onClick={this.close}>{closeLinkText}</a>
|
||||
windowUnloaded: () ->
|
||||
JamTrackPlayerActions.windowUnloaded() unless window.DontAutoCloseMedia
|
||||
|
||||
|
|
@ -427,16 +430,23 @@ mixins.push(Reflux.listenTo(JamTrackPlayerStore, 'onJamTrackPlayerStoreChanged')
|
|||
e.preventDefault()
|
||||
|
||||
downloadMixdownReady: (mixdown, e) ->
|
||||
e.preventDefault()
|
||||
|
||||
|
||||
if mixdown.myPackage?.signing_state == 'SIGNED'
|
||||
iframe = document.createElement("iframe")
|
||||
iframe.src = window.location.protocol + '//' + window.location.host + "/api/mixdowns/#{mixdown.id}/download.mp3?file_type=mp3&sample_rate=48&download=1"
|
||||
iframe.style.display = "none"
|
||||
document.body.appendChild(iframe);
|
||||
if /iPhone|iPad|iPod/i.test(navigator.userAgent)
|
||||
# fall through
|
||||
else
|
||||
e.preventDefault()
|
||||
iframe = document.createElement("iframe")
|
||||
iframe.src = @downloadMixdownUrl(mixdown)
|
||||
iframe.style.display = "none"
|
||||
document.body.appendChild(iframe);
|
||||
else
|
||||
alert("The mix is not yet ready to download")
|
||||
|
||||
downloadMixdownUrl: (mixdown) ->
|
||||
window.location.protocol + '//' + window.location.host + "/api/mixdowns/#{mixdown.id}/download.mp3?file_type=mp3&sample_rate=48&download=1"
|
||||
|
||||
activateStem: (e) ->
|
||||
e.preventDefault()
|
||||
|
||||
|
|
@ -460,21 +470,32 @@ mixins.push(Reflux.listenTo(JamTrackPlayerStore, 'onJamTrackPlayerStoreChanged')
|
|||
JamTrackPlayerActions.openStem(selectedTrackId)
|
||||
|
||||
downloadStem: (e) ->
|
||||
e.preventDefault()
|
||||
|
||||
$select = $(this.getDOMNode()).find('.active-stem-select')
|
||||
|
||||
selectedTrackId = $select.val()
|
||||
|
||||
if !selectedTrackId? || selectedTrackId == ''
|
||||
alert("You must select a track in order to download.")
|
||||
else
|
||||
e.preventDefault()
|
||||
alert("You must select a track in order to download and also click the folder icon.")
|
||||
else
|
||||
if /iPhone|iPad|iPod/i.test(navigator.userAgent)
|
||||
if @state.jamTrackState.jamTrack?.last_stem_id
|
||||
# fall through
|
||||
else
|
||||
e.preventDefault()
|
||||
alert("You must select a track in order to download and also click the folder icon.")
|
||||
else
|
||||
e.preventDefault()
|
||||
|
||||
iframe = document.createElement("iframe")
|
||||
iframe.src = @createStemUrl(@state.jamTrackState.jamTrack.id, stemId)
|
||||
iframe.style.display = "none"
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
createStemUrl: (jamTrackId, stemId) ->
|
||||
window.location.protocol + '//' + window.location.host + "/api/jamtracks/#{jamTrackId}/stems/#{stemId}/download.mp3?file_type=mp3&download=1"
|
||||
|
||||
iframe = document.createElement("iframe")
|
||||
iframe.src = window.location.protocol + '//' + window.location.host + "/api/jamtracks/#{@state.jamTrackState.jamTrack.id}/stems/#{selectedTrackId}/download.mp3?file_type=mp3&download=1"
|
||||
iframe.style.display = "none"
|
||||
document.body.appendChild(iframe);
|
||||
stemChanged: () ->
|
||||
|
||||
mixdownPlay: (mixdown, e) ->
|
||||
|
|
@ -500,13 +521,20 @@ mixins.push(Reflux.listenTo(JamTrackPlayerStore, 'onJamTrackPlayerStoreChanged')
|
|||
JamTrackPlayerActions.activateNoMixdown(jamtrack)
|
||||
|
||||
jamTrackDownload: (jamTrack, e) ->
|
||||
e.preventDefault()
|
||||
|
||||
iframe = document.createElement("iframe")
|
||||
iframe.src = window.location.protocol + '//' + window.location.host + "/api/jamtracks/#{jamTrack.id}/stems/master/download.mp3?file_type=mp3&download=1"
|
||||
iframe.style.display = "none"
|
||||
document.body.appendChild(iframe);
|
||||
if /iPhone|iPad|iPod/i.test(navigator.userAgent)
|
||||
# fall through
|
||||
|
||||
else
|
||||
e.preventDefault()
|
||||
|
||||
iframe = document.createElement("iframe")
|
||||
iframe.src = @createJamTrackUrl(jamTrack)
|
||||
iframe.style.display = "none"
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
createJamTrackUrl: (jamTrack) ->
|
||||
window.location.protocol + '//' + window.location.host + "/api/jamtracks/#{jamTrack.id}/stems/master/download.mp3?file_type=mp3&download=1"
|
||||
|
||||
onEditKeydown: (mixdown, e) ->
|
||||
logger.debug("on edit keydown", e)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ context = window
|
|||
|
||||
@JamTrackPlayerActions = Reflux.createActions({
|
||||
open: {}
|
||||
opened: {}
|
||||
createMixdown: {}
|
||||
editMixdown: {}
|
||||
deleteMixdown: {}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ logger = context.JK.logger
|
|||
|
||||
onOpenExternalUrl: (href) ->
|
||||
|
||||
logger.debug("opening external url #{href}")
|
||||
context.JK.popExternalLink(href)
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ BrowserMediaActions = @BrowserMediaActions
|
|||
@issueChange()
|
||||
|
||||
onMediaStartPlay: (data) ->
|
||||
BrowserMediaActions.play()
|
||||
BrowserMediaActions.play.trigger()
|
||||
|
||||
onMediaStopPlay: (data) ->
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ EVENTS = context.JK.EVENTS
|
|||
|
||||
BrowserMediaActions = @BrowserMediaActions
|
||||
|
||||
Howler._enableiOSAudio()
|
||||
|
||||
@BrowserMediaStore = Reflux.createStore(
|
||||
{
|
||||
listenables: BrowserMediaActions
|
||||
|
|
@ -19,6 +21,7 @@ BrowserMediaActions = @BrowserMediaActions
|
|||
media_type: null
|
||||
cachedAudio: []
|
||||
cache_size: 10
|
||||
preload: true
|
||||
|
||||
playbackState:(position, time) ->
|
||||
state = {}
|
||||
|
|
@ -63,7 +66,7 @@ BrowserMediaActions = @BrowserMediaActions
|
|||
@audio = null
|
||||
@id = id
|
||||
@media_type = media_type
|
||||
@loading = true
|
||||
@loading = @preload
|
||||
@playing = false
|
||||
@paused = false
|
||||
|
||||
|
|
@ -81,7 +84,7 @@ BrowserMediaActions = @BrowserMediaActions
|
|||
autoplay: false,
|
||||
loop: false,
|
||||
volume: 1,
|
||||
preload: true,
|
||||
preload: @preload,
|
||||
onend: @onAudioEnded,
|
||||
onload: @onAudioLoaded,
|
||||
onloaderror: @onAudioLoadError,
|
||||
|
|
@ -93,6 +96,7 @@ BrowserMediaActions = @BrowserMediaActions
|
|||
@changed()
|
||||
|
||||
onPlay: () ->
|
||||
logger.debug("BrowerMediaStore:play")
|
||||
if @audio
|
||||
@playing = true
|
||||
@paused = false
|
||||
|
|
@ -121,8 +125,15 @@ BrowserMediaActions = @BrowserMediaActions
|
|||
if @audio
|
||||
@playing = false
|
||||
@paused = false
|
||||
@audio.pause()
|
||||
@audio.seek(0)
|
||||
try
|
||||
@audio.pause()
|
||||
catch e
|
||||
@logger.info("unable to pause on stop", e)
|
||||
try
|
||||
@audio.seek(0)
|
||||
catch e
|
||||
@logger.info("unable to seek to beginning on stop", e)
|
||||
|
||||
|
||||
onSeek: (pos) ->
|
||||
if @audio
|
||||
|
|
|
|||
|
|
@ -36,6 +36,11 @@ BrowserMediaActions = @BrowserMediaActions
|
|||
getState: () ->
|
||||
@state
|
||||
|
||||
onOpened: (jamTrack, popup=true) ->
|
||||
@jamTrack = jamTrack
|
||||
|
||||
@changed()
|
||||
|
||||
onOpen: (jamTrack, popup=true) ->
|
||||
|
||||
|
||||
|
|
@ -55,10 +60,13 @@ BrowserMediaActions = @BrowserMediaActions
|
|||
@childWindow.close()
|
||||
|
||||
logger.debug("opening JamTrackPlayer window")
|
||||
@childWindow = window.open("/popups/jamtrack-player/" + @jamTrack.id, 'Media Controls', 'scrollbars=yes,toolbar=no,status=no,height=667,width=450')
|
||||
@childWindow = window.open(@createPopupUrl(jamTrack), 'Media Controls', 'scrollbars=yes,toolbar=no,status=no,height=667,width=450')
|
||||
|
||||
@changed()
|
||||
|
||||
createPopupUrl: (jamTrack) ->
|
||||
"/popups/jamtrack-player/" + jamTrack.id
|
||||
|
||||
onWindowUnloaded: () ->
|
||||
BrowserMediaActions.stop()
|
||||
@childWindow = null
|
||||
|
|
|
|||
|
|
@ -9,6 +9,12 @@ if window.opener?
|
|||
catch e
|
||||
reactContext = window
|
||||
|
||||
userAgent = window.navigator.userAgent;
|
||||
if /iPhone|iPad|iPod|android/i.test(navigator.userAgent)
|
||||
# iPad or iPhone
|
||||
reactContext = window
|
||||
|
||||
|
||||
VideoStore = reactContext.VideoStore
|
||||
VideoActions = reactContext.VideoActions
|
||||
PlatformStore = reactContext.PlatformStore
|
||||
|
|
|
|||
|
|
@ -2,6 +2,15 @@
|
|||
|
||||
body.jamtrack-player-popup.popup {
|
||||
|
||||
.wrapper {
|
||||
width: 450px;
|
||||
position: relative;
|
||||
margin: 0px auto;
|
||||
padding: 0 10px 10px;
|
||||
border-width: 0 1px 1px;
|
||||
border-color: #ed3618;
|
||||
border-style: solid;
|
||||
}
|
||||
text-align:center;
|
||||
|
||||
background-color: #242323;
|
||||
|
|
@ -9,6 +18,10 @@ body.jamtrack-player-popup.popup {
|
|||
#minimal-container {
|
||||
padding-bottom:0;
|
||||
}
|
||||
|
||||
.show-hide-my-mixes, .show-hide-mix-controls {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.media-controls-popup {
|
||||
padding:15px 15px 3px 15px;
|
||||
|
|
@ -42,9 +55,9 @@ body.jamtrack-player-popup.popup {
|
|||
}
|
||||
|
||||
.help-link {
|
||||
position:absolute;
|
||||
left:-6px;
|
||||
top:0;
|
||||
//position:absolute;
|
||||
//left:-6px;
|
||||
//top:0;
|
||||
}
|
||||
.close-link {
|
||||
|
||||
|
|
|
|||
|
|
@ -359,6 +359,7 @@ if defined?(Bundler)
|
|||
config.estimate_taxes = true
|
||||
config.ad_sense_enabled = false
|
||||
config.guard_against_fraud = true
|
||||
config.guard_against_browser_fraud = true
|
||||
config.error_on_fraud = false
|
||||
config.expire_fingerprint_days = 14
|
||||
config.found_conflict_count = 1
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ SampleApp::Application.configure do
|
|||
config.email_alerts_alias = ENV['ALERT_EMAIL'] || 'alerts-dev@jamkazam.com'
|
||||
config.email_social_alias = ENV['ALERT_EMAIL'] || 'social-dev@jamkazam.com'
|
||||
config.guard_against_fraud = true
|
||||
config.guard_against_browser_fraud = false
|
||||
|
||||
config.react.variant = :development
|
||||
|
||||
|
|
|
|||
|
|
@ -126,6 +126,10 @@ def web_config
|
|||
def download_tracker_day_range
|
||||
30
|
||||
end
|
||||
|
||||
def guard_against_browser_fraud
|
||||
true
|
||||
end
|
||||
end
|
||||
klass.new
|
||||
end
|
||||
|
|
|
|||
|
|
@ -200,6 +200,11 @@
|
|||
// then check if the audio actually played to determine if
|
||||
// audio has now been unlocked on iOS.
|
||||
var unlock = function() {
|
||||
if(self.attemptedIos) {
|
||||
return;
|
||||
}
|
||||
self.attemptedIos = true;
|
||||
|
||||
// Create an empty buffer.
|
||||
var buffer = ctx.createBuffer(1, 1, 22050);
|
||||
var source = ctx.createBufferSource();
|
||||
|
|
|
|||
Loading…
Reference in New Issue