New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TIMOB-5436] iOS: Expose System Sound Services #8396
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First CR-cycle done, please address the review-comments.
description: | | ||
You can use this module to provide audible alerts. | ||
|
||
You can use it to play short (30 seconds or shorter) sounds. The interface does not provide level, positioning, looping, or timing control, and does not support simultaneous playback: You can play only one sound at a time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Watch out for proper line-breaks (see other API's), so the line does not get too long.
Use the <Titanium.Media.createAlert> method to create a `Alert` object. | ||
|
||
Know more about [System Sound Services](https://developer.apple.com/reference/audiotoolbox/1657326-system_sound_services). | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the empty lines here, it's formatted as a paragraph by the docs-generator.
Know more about [System Sound Services](https://developer.apple.com/reference/audiotoolbox/1657326-system_sound_services). | ||
|
||
extends: Titanium.Proxy | ||
since: "5.5.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to 6.1.0
summary: Starting playing the alert. | ||
|
||
events: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No events? If not, remove it.
platforms: [iphone, ipad] | ||
methods: | ||
- name: play | ||
summary: Starting playing the alert. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Language: Start playing the alert.
@@ -0,0 +1,24 @@ | |||
/** | |||
* Appcelerator Titanium Mobile | |||
* Copyright (c) 2009-2010 by Appcelerator, Inc. All Rights Reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2009-2016
example: | | ||
Simple example of playing a WAVE file from the Resources directory. | ||
|
||
var player = Ti.Media.createAlert({url:"Alert.wav"}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use alert.wav
to be more handy in naming-conventions.
SystemSoundID sound; | ||
} | ||
|
||
@property (nonatomic,readonly) NSURL *url; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this as a property as well? Better make a usual getter -(NSURL*)url
where you create the url instead of just returning it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not understanding this.
} | ||
} else if ([url_ isKindOfClass:[TiBlob class]]) { | ||
TiBlob *blob = (TiBlob*)url_; | ||
if ([blob type]==TiBlobTypeFile){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format: if ([blob type] == TiBlobTypeFile) {
|
||
-(void)play:(id)args | ||
{ | ||
if (url == nil) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use -(void)play:(id)unused
[TIMOB-5436] Refactor class
ping @kopiro @hansemannn What is left over to get this merged? |
Nothing for me, tested and worked after @hansemannn PR |
CR + FT passed, PR approved! |
We may also want unit-tests to ensure the integrity of the
|
JIRA: https://jira.appcelerator.org/browse/TIMOB-5436
You can use this module to provide audible alerts.
This module differs from the Sound module because it honors the ringtone volume, not the Music volume.
Know more about System Sound Services.
Example: