0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Solar2DアプリがAndroid端末で動画ストリーミング再生できない

Last updated at Posted at 2022-05-11

media.playVideoがリモートで動作しない

Solar2Dで開発したAndroidアプリで動画ストリーミングができない。
シミュレータとiOS端末では問題なく、Android端末のみ発生する問題。
media.playVideoのAPIリファレンスを見ると、ローカル、リモートどちらも再生できると記載があるが、なぜかストリーミング再生ができない。

サンプルソース

サンプルソースをビルドし、Android端末で動かしてみる。

main.lua
local onComplete = function( event )
    print( "video session ended" )
 end
media.playVideo( "https://coronalabs.com/video/bbb/BigBuckBunny_640x360.m4v", media.RemoteSource, true, onComplete)

解決方法

solar2d 3619でビルドした際は問題なく、solar2d 3665でビルドすると発生
バージョンかOSのセキュリティの問題か原因は不明。
ローカルに動画があれば再生できるので、ダウンロードして再生する方法で対応

main.lua
local path
local params = {}
local function networkListener( event )
    local function onComplete()
        os.remove( path )
    end
    path = system.pathForFile( "temp.m4v", system.TemporaryDirectory )
    media.playVideo( path, true, onComplete)
end
    
network.download(
    "https://coronalabs.com/video/bbb/BigBuckBunny_640x360.m4v",
    "GET",
    networkListener,
    params,
    "temp.m4v",
    system.TemporaryDirectory
)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?