Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Highlighted
Developer
Posts: 77
Registered: ‎07-12-2014
My Device: Z10
My Carrier: AT & T

Radio online

How to open the audio player online from a website in my app.
Developer
Posts: 77
Registered: ‎07-12-2014
My Device: Z10
My Carrier: AT & T

Re: Radio online

[ Edited ]

Please help me

Developer
Posts: 77
Registered: ‎07-12-2014
My Device: Z10
My Carrier: AT & T

Re: Radio online

Help me
Developer
Posts: 75
Registered: ‎12-11-2013
My Device: BlackBerry Z10
My Carrier: Maxis

Re: Radio online

Do you mean open the website player or the device player for streaming. Please post more information so other can understand your questions.
Developer
Posts: 77
Registered: ‎07-12-2014
My Device: Z10
My Carrier: AT & T

Re: Radio online

[ Edited ]

I want when I open a radio channel, this channel will be connected online to a website. Here is my code:

 

import bb.cascades.multimedia 1.0
import bb.multimedia 1.0
import bb.cascades 1.0
import bb.system 1.0
Page {
    property variant stations;
    titleBar: TitleBar {
        title: stations.name    
    }
    Container {
        verticalAlignment: VerticalAlignment.Center
        horizontalAlignment: HorizontalAlignment.Center
        topPadding: 50
        ImageView {
            horizontalAlignment: HorizontalAlignment.Center
            imageSource: "asset:///images_channel/gaixinh.jpg"
            preferredWidth: 700
            preferredHeight: 600
        }
        Label {
            textStyle.base: SystemDefaults.TextStyles.BigText
            horizontalAlignment: HorizontalAlignment.Center            
            textStyle.fontWeight: FontWeight.Normal
            textStyle.fontSize: FontSize.XLarge
            text: stations.description
        }
    } // Container 
    actions: [
        ActionItem {
            id: playpause
            title: "Play"
            ActionBar.placement: ActionBarPlacement.OnBar
            imageSource: "asset:///images/ic_play.png"
            onTriggered: {
                // This function starts and stops
                // audio playing.
                togglePlayPauseItems()
                if (player.mediaState == MediaState.Started)
                    nowPlaying.revoke()
                else
                    nowPlaying.acquire()
            }
            attachedObjects: [
                MediaPlayer {
                    id: player
                    sourceUrl: "http://vov1.vov.vn/Default.aspx"
                },
                NowPlayingConnection {
                    id: nowPlaying
                    mediaState: player.mediaState
                    onAcquired: {
                        player.play()
                        nowPlaying.mediaState = MediaState.Started
                        nowPlaying.metaData = player.metaData
                    }
                    onPause: {
                        player.pause()
                    }
                    onPlay: {
                        player.play()
                    }
                    onRevoked: {
                        player.stop()
                    }
                }
            ]
        },
        ActionItem {
            ActionBar.placement: ActionBarPlacement.OnBar
            title: "Favorite"
            imageSource: "asset:///images/ic_add_favorite.png"
        },
        ActionItem {
            ActionBar.placement: ActionBarPlacement.OnBar
            title: "Share"
            imageSource: "asset:///images/ic_share.png"
        },
        ActionItem {
            ActionBar.placement: ActionBarPlacement.OnBar
            title: "Sleep Timer"
            imageSource: "asset:///images/ic_overflow_tab.png"
        }
    ]
    function togglePlayPauseItems() {
        if (playpause.title == "Play") {
            playpause.title = "Pause"
            playpause.imageSource = "asset:///images/ic_pause.png"
        } 
        else {
            playpause.title = "Play"
            playpause.imageSource = "asset:///images/ic_play.png"
        }
    }
} // Page

 

I can not connect to this website http://vov1.vov.vn/Default.aspx and play it. Help me Thanks veryone

Developer
Posts: 150
Registered: ‎10-19-2012
My Device: Playbook, BB10DevAlphaB/C, Z10
My Carrier: Sonera, Saunalahti

Re: Radio online

You need to figure out the correct URL to the stream. You are currently using the web site URL, that won't work.

Digging in the page source gives:

This is the HLS stream: http://210.245.60.242:1935/vov1/vov1/playlist.m3u8

and RTMP is rtmp://210.245.60.242:1935/vov1
Developer
Posts: 77
Registered: ‎07-12-2014
My Device: Z10
My Carrier: AT & T

Re: Radio online

Hi

I am the test for HLS stream: http://210.245.60.242:1935/vov1/vov1/playlist.m3u8

When I run the simulation, it does not work, how to play it on my simulation?