- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我一直在阅读文档 https://docs.nativescript.org/modules但我只能找到一个图像小部件。欢迎所有建议。提前致谢!
最佳答案
新答案(2016 年 11 月 10 日编辑)
现在有一个跨平台视频播放器模块可用。只需下载并运行:https://github.com/bradmartin/nativescript-videoplayer
例如
<Page xmlns="http://schemas.nativescript.org/tns.xsd"
xmlns:VideoPlayer="videoplayer">
<StackLayout>
<VideoPlayer:Video
loaded="videoplayerLoaded"
finished="videoFinished"
autoplay="true"
height="300"
src="~/videos/small.mp4"
/>
</StackLayout>
</Page>
旧答案
目前,没有内置的跨平台模块(如图所示)来播放视频。有一个 open issue就此主题而言。但是,由于这是 NativeScript,您可以调用 native API(这就是 NativeScript 脱颖而出的原因)。
下面是一个如何调用 iOS AVAudioPlayer 的例子:
var Clicker = function(resource) {
var soundPath = NSBundle.mainBundle().pathForResourceOfType("app/"+resource, "mp3");
var soundUrl = NSURL.fileURLWithPath(soundPath);
var player = AVAudioPlayer.alloc().initWithContentsOfURLError(soundUrl, null);
player.prepareToPlay();
this.click = function() {
player.currentTime = 0.0;
player.play();
};
};
module.exports.Clicker = Clicker;
完整示例,请参阅https://www.nativescript.org/blog/calcunator-the-nativescript-calculator
您要做的是查看每个平台的 API 并进行调用。
媒体播放器的文档:
同样好的阅读是 NativeScripts documentation on how to call the native APIs from NativeScript .
关于android - 有没有办法在 NativeScript 中播放视频?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30997824/
如何在 Nativescript + Angular 中实现 RadioButtons? 我试过 RadioButton 插件,但它在编译时出错。我在 stackoverflow 上看到一篇文章说要使
每当我单击 window 的 nativeScript sidekick 下载链接时,它都会将我重定向到主页。我在那里没有看到 nativescript 助手的任何下载链接。所以我寻找关于sideki
如何在 nativescript-angular 中的分段栏中添加图像图标。你能帮我解决这个问题吗
我正在寻找一个开源的 NS7 替代 nativescript 下拉菜单。有没有人有建议。我正在将我的应用程序移植到 NS7,但无法找到替代付费版本插件的插件。 最佳答案 我的解决方法是打开一个包含下拉
enter image description here如何在 android 中更改启动画面 (LaunchScreenTheme) 的状态栏图标颜色? 我尝试了下面的代码,但它不起作用。 #FFF
Nativescript 5 已发布,我正在尝试更新 tns 版本。目前它 tns --version 显示为 4.3.2。 我遵循了 https://docs.nativescript.org/re
我想将大小为 3000*4200 像素的 SD 卡中的图像调整为 250*250 大小的个人资料图片。我尝试了很多使用 android BitmapFactory 的方法,但没有任何效果。 有这个插件
我想在 NativeScript 的绝对布局中在屏幕底部放置一个元素。 我有这个代码: 我发现 Absolut
最近我在用 nativescript 编写一个应用程序,现在我遇到一个问题,我不知道如何保存用户的登录状态。比如用户第一次登录,以后就不需要登录了。那么我该如何实现呢? 最佳答案 我确实在我的应用程序
我正在尝试在我的 NativeScript 应用程序中创建具有动态行数和列数的表或数据网格。我有一些产品类别和这些类别中的一些产品。产品对其所属类别有一些规范。以下是图形卡类别产品的 JSON 示例:
我没能找到列表选择器的 NS+JS 工作示例,文档中的示例都没有 XML 示例。有人可以帮忙吗? 最佳答案 您需要做的是绑定(bind)一个 的 items属性到页面上的数组 bindingConte
我正在尝试更改 nativescript 中 progress 组件的高度,如下所示: 但是 height 属性没有效果。如何更改此组件的高度? 最佳答案 您可以使用 height 属性更改 Pr
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 2年前关闭。 Improve this qu
在 NativeScript 中,是否可以从 Nativescript 应用程序中启动另一个应用程序? 假设我在一个应用程序中有一个按钮,当按下它时,它会启动 Waze 导航应用程序,并带有一个位置的
你如何附加到文件而不是覆盖它? file-system module文档解释了如何写入文件: The following example writes some text to a file. It
对于NS项目,如何设置最低iOS版本。 我有IPHONEOS_DEPLOYMENT_TARGET = 8.0;在我的build.xcconfig文件中 但是在构建过程中,我收到未设置的消息。 在构建过
我想从 NativeScript 项目中的自定义组件公开一个方法。这是概念设置: 我的组件.xml ...UI markup... MyComponent.ts export function l
使用最新版本的 Nativescript,我根据文档创建了一个插件,并且在运行 tns plugin add ../nativescript-keychain 之后我收到消息 Successfully
NativeScript 中 DIV 的替代方法是什么? 如何使用内嵌内容的 block ? 最佳答案 在浏览器中,div 的行为由 display CSS 属性决定。 例如,默认为block和ver
目前有以下命令: tns cloud build android --accountId= 返回这一行:Invalid accountId index provided 您如何为您的帐户获得正确的 a
我是一名优秀的程序员,十分优秀!